2016-02-28 49 views
0

我有我的項目文件和Calculator01.dll文件在同一目錄中。當我嘗試添加引用Calculator.dll文件出現消息框,並顯示在CalDllWrapperC#錯誤:添加引用到.dll文件

"A reference to 'E\IT131344............Calculato01.dll could not be added. Please make sure file is accessible and that it is a valid assembly or COM component."

我已經打上階級的功能;

[DllImport("Calculator01.dll")] 

迄今爲止發現的解決方案對我無效。我能做些什麼來解決這個問題?請幫幫我。 在此先感謝

+2

Calculator01.dll不是.net dll嗎? – Viru

+0

您不需要添加引用就可以使用DllImport。 – cubrr

+0

@Viru它是基於C的DLL。 C/C++ – Pegasus

回答

0

您不能添加對非託管DLL的引用。只有被管理的DLL可以被引用。非託管DLL只能使用DllImport屬性來使用。請注意應用程序需要能夠訪問DLL。