如何共享的C#的NuGet依赖项添加到C ++ / CLI的项目吗? [英] How to add shared C# NuGet dependencies to a C++/Cli project?

查看:468
本文介绍了如何共享的C#的NuGet依赖项添加到C ++ / CLI的项目吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

环境:Visual Studio解决方案有2个组件,Cs和.cpp的。

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#项目。我用由作者所提供的原包装。将它们添加到铯项目工作正常,但不是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的项目,只需添加一个参考(菜单 - >引用 - >添加新参考 - > Browse->浏览...)到nlog.dll说的NuGet下载到您的[solutionfolder] /包/ n日志...文件夹。 这似乎为我工作。

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的项目吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆