QuickBooks:未解决的SDK参考?

时间:2010-06-18 19:30:56

标签: c# interop reference quickbooks

当我构建示例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,我也尝试删除并再次添加引用。有什么想法吗?

2 个答案:

答案 0 :(得分:4)

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

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

编辑:当您从项目菜单中选择添加参考... 时,是否在 .NET 标签下列出了Interop.QBFC程序集?检查文件是否存在。或者,通过浏览到文件所在的路径,显式添加对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,则需要再次查看参考文献。

答案 1 :(得分:0)

我相信您需要添加对

的引用
C:\Program Files\Common Files\Intuit\QuickBooks\Interop.QBFC8.dll