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 项目?


基础教程推荐
- 首先创建代码,多对多,关联表中的附加字段 2022-01-01
- 经典 Asp 中的 ResolveUrl/Url.Content 等效项 2022-01-01
- 错误“此流不支持搜索操作"在 C# 中 2022-01-01
- 如何动态获取文本框中datagridview列的总和 2022-01-01
- 是否可以在 asp classic 和 asp.net 之间共享会话状态 2022-01-01
- 将事件 TextChanged 分配给表单中的所有文本框 2022-01-01
- 在 VS2010 中的 Post Build 事件中将 bin 文件复制到物 2022-01-01
- 全局 ASAX - 获取服务器名称 2022-01-01
- 从 VS 2017 .NET Core 项目的发布目录中排除文件 2022-01-01
- JSON.NET 中基于属性的类型解析 2022-01-01