我有一個.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