如何在同一解决方案中引用C ++ / CLi项目中的C#项目

时间:2022-09-02 08:54:42

I have two projects in a solution, one is a C# library and the other is a C++/CLI library.

我在解决方案中有两个项目,一个是C#库,另一个是C ++ / CLI库。

I have added a reference in the C++/CLI project using the references menu to the c# library. I then add the

我在C ++ / CLI项目中使用引用菜单添加了一个引用到c#库。然后我添加了

#using <assembly.name.dll>

and try to reference the assembly with

并尝试引用程序集

using namespace namspace.subnamespace;

But i get the error that the assembly.name.dll cannot be found. I have tried matching the case and all lower case for the assembly name but to not avail. Amazingly there is not reference anywhere on the internet about how to reference assemblies you have created yourself.

但我得到无法找到assembly.name.dll的错误。我已经尝试将案例和所有小写字母匹配为程序集名称,但无济于事。令人惊讶的是,互联网上没有任何关于如何引用自己创建的程序集的参考。

What is the correct was to do this and if i'm doing it right, what course should i take to diagnose this.

这是正确的做法,如果我做得对,我应该采取什么方法来诊断这一点。

2 个解决方案

#1


I dont think you need the #using bit if you included a reference.

如果你包含一个引用,我认为你不需要#using位。

#2


You need to add path to your C# assembly to C/C++ > General > Resolve #using References

您需要将C#程序集的路径添加到C / C ++>常规>解析#using References

#1


I dont think you need the #using bit if you included a reference.

如果你包含一个引用,我认为你不需要#using位。

#2


You need to add path to your C# assembly to C/C++ > General > Resolve #using References

您需要将C#程序集的路径添加到C / C ++>常规>解析#using References