11

since upgrading my project to VS2010, including the use of MSBuild v4 instead of 3.5 (and not making any other changes), I get the following build error and have no clue how to fix it (log from CC.NET):

  <target name="ResolveComReferences" success="false">
   <message level="high"><![CDATA[C:\Programme\Microsoft SDKs\Windows\v7.0A\bin\TlbImp.exe c:\Assemblies\NMSDVDXU.dll /namespace:NMSDVDXLib /machine:X64 /out:obj\x64\Release\Interop.NMSDVDXLib.dll /sysarray /transform:DispRet /reference:c:\Assemblies\Bass.Net.dll /reference:c:\Assemblies\LogicNP.FileView.dll /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorlib.dll /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Data.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.Management.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:\WINDOWS\assembly\GAC\stdole\7.0.3300.0__b03f5f7f11d50a3a\stdole.dll ]]></message>
   <error code="TI0000" file="TlbImp"><![CDATA[A single valid machine type compatible with the input type library must be specified.]]></error>
   <warning code="MSB3283" file="C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets" line="1558" column="9"><![CDATA[Die Wrapperassembly für die Typbibliothek "NMSDVDXLib" wurde nicht gefunden.]]></warning>
   <message level="high"><![CDATA[C:\Programme\Microsoft SDKs\Windows\v7.0A\bin\TlbImp.exe c:\Assemblies\StarBurnX12.dll /namespace:RocketDivision.StarBurnX /machine:X64 /out:obj\x64\Release\Interop.RocketDivision.StarBurnX.dll /sysarray /transform:DispRet /reference:c:\Assemblies\Bass.Net.dll /reference:c:\Assemblies\LogicNP.FileView.dll /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorlib.dll /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Data.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.Management.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:\WINDOWS\assembly\GAC\stdole\7.0.3300.0__b03f5f7f11d50a3a\stdole.dll ]]></message>
   <error code="TI0000" file="TlbImp"><![CDATA[A single valid machine type compatible with the input type library must be specified.]]></error>
   <warning code="MSB3283" file="C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets" line="1558" column="9"><![CDATA[Die Wrapperassembly für die Typbibliothek "RocketDivision.StarBurnX" wurde nicht gefunden.]]></warning>
  </target>

Problem: A single valid machine type compatible with the input type library must be specified.

It only applies to the x64 build of my project, x86 still works fine. Apparently, it tries to build a x64 interop assembly from the x86 DLL located in "C:\Assemblies". When executing the TlbImp command with the x64 DLL which is located in a different directory, it works fine. However, I don't know how I can configure my project to use different COM references for the x86 and x64 build. The OS on which the project is being compiled is WinXP x86. Building worked fine when using VS2005 + MSBuild 3.5

Any help would be highly appreciated.

I tried building the upgraded project with MSBuild v3.5, but that doesn't work either. It complains about unknown NoWarn codes (probably new in 4.0).

floele
  • 3,668
  • 4
  • 35
  • 51
  • I'm having this exact same error after moving to TFS2010 and VS2010. We build all our projects in AnyCPU and haven't had any problems using CC.NET (except when using specifically x86 or x64), and now do with TFS. – Jeff Wain May 12 '10 at 19:22
  • Did now bring that up on MS Connect, let's see what happens: http://connect.microsoft.com/VisualStudio/feedback/details/711406/tlbimp-error-since-vs2010-a-single-valid-machine-type-compatible-with-the-input-type-library-must-be-specified – floele Dec 14 '11 at 21:02

4 Answers4

2

I finally came up with the "solution". As pointed out on MS Connect, the change in x64 build behaviour was intentional apparently. As of VS2010 and later, an x64 build system is required for an x64 build of your application, so I was forced to upgrade my build system to x64 (which basically means reinstalling everything). Then, for the x64 build, you have to use the x64 version of MSBuild, which is located in the "Framework64" folder (more details on the Visual Studio blog: Building on Cross targeting scenarios and 64-bit MSBuild).

floele
  • 3,668
  • 4
  • 35
  • 51
2

We had a similar problem with com references for x64 (but different error message), and it turned out that the AnyCPU was missing on the project file (similar to Adam Driscoll's comment). This meant that the x86 interop was being used for both x86 abd x64 builds.

In the csproj file, add this node under each node. When the project is built, the platform independant interop is created/used.

Mahen
  • 126
  • 6
  • I can't use AnyCPU though. I need both an x86 and x64 build of my application. The x86 version ships with x86 DLLs, and if I'd compile it with AnyCPU, it would run as x64 on x64 operating systems, not being able to load the installed x86 DLLs. – floele Nov 12 '11 at 15:13
  • You don't have to compile the application as anycpu, this tag will import the resource as anycpu so that it works in both x86 and x64 build. – Mahen Nov 28 '11 at 12:58
  • This shouldn't work, since I do not use the "AnyCPU" config for compiling, and it does in fact not work. It makes no difference whether or not the AnyCPU-PropertyGroups have a PlatformTarget or not. – floele Dec 03 '11 at 22:19
1

It may be due to an issue with your project where the platform target node is missing: Visual Studio 2010 64-bit COM Interop Issue

Not quite sure if this is the same issue...

Community
  • 1
  • 1
Adam Driscoll
  • 9,395
  • 9
  • 61
  • 104
0

I think you'll find this is because the targetted assembly must be compiled for the same cpu type as the project build.

Have you considered having 2 projects that contain the same files then refer to the x64 / x86 versions of your target assembly in them?

It may mean having 2 instances of VS open but at least all you need to do is edit then switch and build.

The issue may also be because you are trying to build 64 bit code on a 32bit OS ... I don't think so though, only running the code would be an issue as far as i'm aware.

War
  • 8,539
  • 4
  • 46
  • 98
  • I cannot reference the x64 DLL *at all* on the compiler system, because it's not an x64 OS and thus no x64 COM DLLs can be registered. – floele May 20 '10 at 15:14