3

当我构建示例 QuickBooks SDK 代码的 MCInvoiceAddQBFC C# 应用程序时,构建失败并显示

C:\Windows\Microsoft.NET\Framework\v2.0.50727\Microsoft.Common.targets : warning MSB3245: Could not resolve this reference. Could not locate the assembly "Interop.QBFC8, Version=8.0.0.28, Culture=neutral, PublicKeyToken=31d8aec643e18259". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. 

C:\Windows\Microsoft.NET\Framework\v2.0.50727\Csc.exe /noconfig /nowarn:1701,1702 /platform:x86 /errorreport:Prompt /warn:4 /define:DEBUG;TRACE /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\Microsoft.Vsa.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Data.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Deployment.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Design.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Drawing.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Security.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Web.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Windows.Forms.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Xml.dll /debug+ /debug:full /optimize- /out:obj\Debug\MCInvoiceAddQBFC.exe /resource:obj\Debug\MCInvoiceAddQBFC.Form1.resources /resource:obj\Debug\IntuitQBFC.Properties.Resources.resources /target:winexe Form1.cs Form1.Designer.cs Program.cs Properties\AssemblyInfo.cs Properties\Resources.Designer.cs Properties\Settings.Designer.cs SessionFramework\Defaults.cs SessionFramework\ENEdition.cs SessionFramework\Logger.cs SessionFramework\QBException.cs SessionFramework\QBNoResponseException.cs SessionFramework\QBResultException.cs SessionFramework\SessionManager.cs 

C:\Users\ESSEFF\Documents\Visual Studio 2005\Projects\MCInvoiceAddQBFC\Intuit_QBFC\Form1.cs(12,7): error CS0246: The type or namespace name 'Interop' could not be found (are you missing a using directive or an assembly reference?) 

C:\Users\ESSEFF\Documents\Visual Studio 2005\Projects\MCInvoiceAddQBFC\Intuit_QBFC\SessionFramework\SessionManager.cs(11,7): error CS0246: The type or namespace name 'Interop' could not be found (are you missing a using directive or an assembly reference?)

查看解决方案资源管理器,我看到有一个关于 Interop.QBFC8 的警告标志,它与构建输出中的第一条警告行一致。我确实安装了 SDK,并且我还尝试再次删除和添加引用。任何的想法?

4

2 回答 2

4

您显然没有正确引用 DLL。我不熟悉 QuickBooks SDK,但如果您注意到您的csc.exe行,则没有对任何 QuickBooks dll 的引用。

您是否在解决方案的每个项目中添加了正确的引用?

编辑:当您从项目菜单中选择Add reference...时,Interop.QBFC 程序集是否列在.NET选项卡下?检查该文件是否存在。或者,通过浏览文件存在的路径显式添加对 DLL 的引用。您甚至可以先将 DLL 复制到您的项目文件夹中。

编辑:引用 COM 接口会动态创建 Interop.XXX.dll。如果 QBFC8 作为 COM 引用添加,请确保您在 References 文件夹中看到它。您可能需要更改using Interop.QBFC8;using QBFC8;. 正如我所提到的,我注意到的第一件事是您的csc.exe行没有显示正确的参考。这是我使用不同的 COM 引用构建项目时的行:

C:\Windows\Microsoft.NET\Framework\v3.5\Csc.exe /noconfig /nowarn:1701,1702 errorreport:prompt /warn:4 /define:DEBUG;TRACE /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Core.dll"
    /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Data.DataSetExtensions.dll" 
    /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Data.dll 
    /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Deployment.dll 
    /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.dll 
    /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Drawing.dll 
    /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Windows.Forms.dll 
    /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Xml.dll 
    /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Xml.Linq.dll" 

    /reference:obj\Debug\Interop.COMSVCSLib.dll

    /debug+ /debug:full /filealign:512 /optimize- 
    /out:obj\Debug\WindowsFormsApplication1.exe 
    /resource:obj\Debug\WindowsFormsApplication1.Form1.resources 
    /resource:obj\Debug\WindowsFormsApplication1.Properties.Resources.resources /target:winexe
    Form1.cs Form1.Designer.cs Program.cs Properties\AssemblyInfo.cs Properties\Resources.Designer.cs Properties\Settings.Designer.cs

如果您没有看到/reference:obj\Debug\Interop.XXX.dll,则需要再次查看您的参考资料。

于 2010-06-18T19:39:01.527 回答
0

我相信你需要添加一个参考

C:\Program Files\Common Files\Intuit\QuickBooks\Interop.QBFC8.dll
于 2010-06-19T05:29:28.460 回答