views:

186

answers:

2

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?

+1  A: 

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.

maxwellb
If deployment is a concern, and you are receiving an error on the client, someone else may have had a similar issue: http://social.msdn.microsoft.com/forums/en-US/winformssetup/thread/50ca7296-4a59-4c2c-8c8e-abe40ff4ba21/
maxwellb
Do you mean Project->Add Reference ? In fact, I'm talking about the SDK sample code, so I expect merely opening the project and building it would just work. I did try creating a new project, adding the COM reference from the SDK, and then writing a single `using Interop.QBFC8;`. This resulted in a similar error of the reference not resolved.
esseff
Deployment is not an issue -- yet. I'm working locally on my own machine, and I can't even get the sample code to build.
esseff
The .NET tab doesn't list the reference. It's a COM object, and the SDK references are listed in the COM tab.
esseff
your using statement likely should just be QBFC8, not Interop.QBFC8
maxwellb
Oh my! I think I see the issue now. Indeed, there's a bad dll reference: the dll is in ...\Program Files (x86)\... Where on Earth this bizarre folder name came from is beyond me. This laptop isn't mine. :-S I think this implies there's a bug in the SDK installer or in the SDK samples, because the installer installs the files in one place while the samples' references refer to another.
esseff
Oh would that we could build every samples distribution with no modifications. Alas, sometimes we need to change one thing or another, hopefully as simple as a directory reference.Check the errors, and see if you can manually update references.I suggest the change in `using` statement, because when I add a reference to a COM object from within VS, it creates a namespace of "XYZ", but a dll named "Interop.XYZ.dll". Confusing? Maybe.
maxwellb
A: 

I believe you need to add a reference to

C:\Program Files\Common Files\Intuit\QuickBooks\Interop.QBFC8.dll
Paul Keister