【问题标题】:QuickBooks: unresolved SDK reference?QuickBooks:未解决的 SDK 参考?
【发布时间】:2010-06-18 19:30:55
【问题描述】:

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

【问题讨论】:

    标签: c# interop reference quickbooks


    【解决方案1】:

    您显然没有正确引用 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,您需要再次查看您的参考资料。

    【讨论】:

    • 如果部署是一个问题,并且您在客户端收到错误,那么其他人可能遇到了类似的问题:social.msdn.microsoft.com/forums/en-US/winformssetup/thread/…
    • 您的意思是 Project->Add Reference 吗?事实上,我说的是 SDK 示例代码,所以我希望只打开项目并构建它就可以工作。我确实尝试过创建一个新项目,从 SDK 添加 COM 引用,然后编写一个 using Interop.QBFC8;。这导致引用未解析的类似错误。
    • 部署还不是问题。我在自己的机器上本地工作,我什至无法构建示例代码。
    • .NET 选项卡没有列出参考。它是一个 COM 对象,SDK 引用列在 COM 选项卡中。
    • 您的 using 语句可能应该只是 QBFC8,而不是 Interop.QBFC8
    【解决方案2】:

    我相信你需要添加对

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-04-05
      • 1970-01-01
      • 2021-08-17
      • 2016-12-14
      • 2020-05-27
      • 2019-11-16
      • 2021-01-24
      • 2023-03-25
      相关资源
      最近更新 更多