How to add shared C# NuGet dependencies to a C++/Cli project?(如何将共享的 C# NuGet 依赖项添加到 C++/Cli 项目?)
问题描述
上下文:具有 2 个程序集 Cs 和 Cpp 的 Visual Studio 解决方案.
Context: A Visual Studio solution with 2 assemblies, Cs and Cpp.
- Cs 是一个 C#/.net45 dll
- Cpp是一个C++/Cli dll,一个用/clr编译的C++ dll.
我有一些依赖项是来自 nuget.org 的纯 C# 项目.我使用作者提供的原始软件包.将它们添加到 Cs 项目可以正常工作,但不能添加到 Cpp.
I have some dependencies that are pure C# projects from nuget.org. I use the original packages provided by the authors. Adding them to the Cs project works fine, but not to Cpp.
如何将 C# 包添加到 C++ 项目中?
How can I add the C# package to the C++ project?
由于它是 C++/Cli,我可以轻松使用 .net 对象,并且我使用例如在 C# 库中的 C++ 库中.但不知何故,nuget 只允许我选择 C# 项目来添加 C# 依赖项,而不是 C++/clr 项目.
Since it's C++/Cli, I can easily use .net objects, and I use e.g. in the C++ library stuff from the C# library. But somehow nuget only allows me to select C# projects to add a C# dependency to, not C++ /clr ones.
推荐答案
在您的 C++/CLI 项目中,只需添加一个引用 (Menu->References->Add New Reference->Browse->Browse...) 到nuget 下载到您的 [solutionfolder]/packages/nlog... 文件夹的 nlog.dll.这似乎对我有用.
In your C++/CLI project, just add a reference (Menu->References->Add New Reference->Browse->Browse...) to the nlog.dll that nuget downloads to your [solutionfolder]/packages/nlog... folder. That seems to work for me.
这篇关于如何将共享的 C# NuGet 依赖项添加到 C++/Cli 项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何将共享的 C# NuGet 依赖项添加到 C++/Cli 项目?
基础教程推荐
- 在 VB6 或经典 ASP 中使用 .NET 2022-01-01
- 更新 Visual Studio 中的 DataSet 结构以匹配新的 SQL 数据库结构 2022-01-01
- 获取C#保存对话框的文件路径 2022-01-01
- 如果条件可以为空 2022-01-01
- 将数据集转换为列表 2022-01-01
- Mono https webrequest 失败并显示“身份验证或解密失败" 2022-01-01
- C# 9 新特性——record的相关总结 2023-04-03
- 重新排序 WPF TabControl 中的选项卡 2022-01-01
- SonarQube C# 分析失败“不是指针的有效行偏移" 2022-01-01
- 从 C# 控制相机设备 2022-01-01
