Question

After moving my build server I get the following error:

C:\Windows\Microsoft.NET\Framework64\v3.5\Microsoft.Common.targets (1682): Could not run the "GenerateResource" task because MSBuild could not create or connect to a task host with runtime "CLR2" and architecture "x64". Please ensure that (1) the requested runtime and/or architecture are available on the machine, and (2) that the required executable "MSBuildTaskHost.exe" exists and can be run.

My configuration says this:

<ConfigurationToBuild Include="Release|Any CPU">
    <FlavorToBuild>Release</FlavorToBuild>
    <PlatformToBuild>Any CPU</PlatformToBuild>
 </ConfigurationToBuild>

What am I missing?

Was it helpful?

Solution 2

In my case, I received that error message when trying to build a solution on a 32-bit Windows 7 machine. The way to resolve the error for me was to right-click on the project in VS, choose properties, then go to the Build tab. In here I changed the "Platform target" from "Any CPU" to "x86". HTH

OTHER TIPS

To resolve this, Go to your .csproj file and open with notepad.

Add the following line under the default property group:

<PropertyGroup>
      <DisableOutOfProcTaskHost>true</DisableOutOfProcTaskHost>
</PropertyGroup>

Project should compile now.

Another approach is to do the following

Click Start ->> right-click Computer ->> Properties ->> Advanced system settings ->> click Environment Variables button to open the dialog,

then under the System variables section, click New… button, type the Variable name = DISABLEOUTOFPROCTASKHOST, and type the Variable value = 1,

then click Ok.

This should suppress this error.

You need to install .NET SDK for the version of .NET that you are using. Here is a link for .NET 3.5 Where is the .net 3.5 SDK? and here is a link for 4.0 http://www.microsoft.com/en-us/download/details.aspx?id=8279

Installing Visual Studio will install the right SDK as well, but may not be a good option for you.

I hope that helps.

The core problem is the fact that an 64-bit executable can not load a 32-bit dll and vice-versa.

"Auto" means that . NET assembly will switch at runtime between the platforms, depending on what platform is on the machine it is currently running on.

So having a .NET assembly compiled with "Auto" loading an 32-bit dll is a problem waiting to happen, and this is what this error is all about.

To correct it, if you are NOT using any native dlls, go to the properties of the project for every managed project and set "target CPU" to be the same as currently selected "Platform", for all available platforms.

If you are using native dlls, you have to define 2 build configurations one for 32 bit and one for 64 bit, link (refer) the correct versions of the dlls and install according to the target computer platform.

I resolved this issue by opening VS2010 as administrator.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top