Question

When I build the MCInvoiceAddQBFC C# application of the sample QuickBooks SDK code, the build fails with

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?)

Looking at the Solution Explorer I see there's a warning sign about Interop.QBFC8, which agrees with the first warning line in the build output. I did install the SDK, and I also tried removing and adding the reference again. Any idea?

Was it helpful?

Solution

You apparently are not referencing the DLL correctly. I am not familiar with the QuickBooks SDK, but if you notice your csc.exe line, there is no reference to any QuickBooks dll.

Have you added the proper reference in each project in your solution?

Edit: Is the Interop.QBFC assembly listed under the .NET tab when you choose Add reference... from the project menu? Check that the file exists there. Alternately, add a reference to the DLL explicitly by browsing to the path that the file exists. You can even copy the DLL to your project folder first.

Edit: Referencing a COM interface creates the Interop.XXX.dll dynamically. If QBFC8 is added as a COM reference, make sure you see it in the References folder. You may need to change using Interop.QBFC8; to using QBFC8;. The first thing I noticed, as I mentioned was that your csc.exe line does not show the proper reference. Here is the line when I build a project with a different COM reference:

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

If you are not seeing the /reference:obj\Debug\Interop.XXX.dll, you need to look at your references again.

OTHER TIPS

I believe you need to add a reference to

C:\Program Files\Common Files\Intuit\QuickBooks\Interop.QBFC8.dll
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top