我有一个.NET库,我想通过COM来包装它以从C++调用它的函数。幸运的是,这个库是开源的,如果我加入这个项目中的COM可见的类正确的 - 它的工作原理:将原生dll或.NET程序集嵌入COM
[Guid("38F752CC-20F1-4729-B1E3-EE0AAD145052")]
public interface IQRCodeUI
{
string GetDecodedString(string encodedString);
}
[Guid("D4CFCDFA-6718-494D-A23F-EBC0F9550377")]
public class QRCodeUI : IQRCodeUI
{
public string GetDecodedString(string encodedString)
{
return decoder.decode(encodedString);
}
}
decoder
距离这很图书馆的一类。
但是如果我要编译程序集,该怎么办?我尝试创建类库(COM)并将.NET库添加为嵌入式资源。没有结果!在编译过程中,我说了一些类似cannot register assembly "path\name". Cannot load file or assembly "nameOfAssembly" or its dependency. Cannot find the file.
的道歉,我无法提供原始文本的错误,因为我有MSVS,哪种语言与英语不同。有没有可能解决这个问题?
什么是你的问题?你想使用COM调用C++的w/o .NET代码吗? – 2014-10-10 04:00:17
@丹,问题是如何通过COM使用C++编译的.NET程序集的函数? – Nolesh 2014-10-10 05:40:49