Could not run the “GenerateResource” task because MSBuild could not create or connect to a task host with runtime “CLR2” and architecture “x86”.

Since I have experienced the same error more than three times while creating Windows Service (.NET 3.5) on Visual Studio 2012 and/or 2013, I think I should post a solution here for my quick reference. If you create a Windows Service and target .NET 3.5 on Visual Studio 2012 or 2013, you might experience the error message while compiling the project.

Here is the full error message:

Could not run the “GenerateResource” task because MSBuild could not create or connect to a task host with runtime “CLR2” and architecture “x86”. Please ensure that (1) the requested runtime and/or architecture are available on the machine, and (2) that the required executable “C:\Program Files (x86)\MSBuild\12.0\bin\MSBuildTaskHost.exe” exists and can be run.

To resolve it, go to your csproj file and add the following line under the default property group:

<PropertyGroup>

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

And that should resolve the issue, everything should be compiled.

 

Advertisements

13 thoughts on “Could not run the “GenerateResource” task because MSBuild could not create or connect to a task host with runtime “CLR2” and architecture “x86”.

  1. This also fixed the same error on a company PC when trying to compile a WPF App targeting .NET 3.5. Thanks so much!

  2. To all looking for “.csproj”: Could also be “.vbproj”, depending on he Language selected!!!
    So look for “*.??proj” in the project folder.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s