vladimir.karukes
vladimir.karukes

Reputation: 91

Msbuild fails with error msb4064 and msb4063

After installing Visual Studio 2012 with .NET 4.5 I started to get the following errors while building using msbuild:

The "SdkToolsPath" parameter is not supported by the "GenerateResource" task. Verify the parameter exists on the task, and it is a settable public instance property.

The "GenerateResource" task could not be initialized with its input parameters. Project file header is as follows:

    <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">

Any ideas what changes have been made in .NET 4.5 that could cause the abover errors?

Upvotes: 9

Views: 13302

Answers (4)

Alin
Alin

Reputation: 394

I just stumbled on this recently and what fixed it was to close and reopen visual studio. I was working on some azure functions with dotnetcore 2.1 in visual studio enterprise 2019 16.10.2

Upvotes: 0

Scott Baldwin
Scott Baldwin

Reputation: 431

Actually a better solution if you have performed the workaround suggested by Bernard i.e. (If your build fails with “MSB6002: The command-line for the “ResGen” task is too long”). is to remove the workaround from your project file completely. Microsoft have actually fixed the need for this workaround with the Visual Studio 2012 SDK tools.

See the discussion on connect regarding this problem.

Upvotes: 1

Scott Baldwin
Scott Baldwin

Reputation: 431

It's an issue with the Microsoft.Common.targets file in C:\Windows\Microsoft.Net\v4.0.30319. After you install Visual Studio 2012, this file is changed. One of the changes made is to do with "fixing" the GenerateResourceMSBuildRuntime in the case where someone upgrades their machine to Windows 8 (read the elaborate comment at line 2271 for details). My fix was simply to comment out the following line in the Microsoft.Common.targets file

<GenerateResourceMSBuildRuntime 
     Condition="'$(GenerateResourceMSBuildRuntime)' == '' and 
                 $([MSBuild]::DoesTaskHostExist(`$(TargetFrameworkAsMSBuildRuntime)`, `$(GenerateResourceMSBuildArchitecture)`))">$(TargetFrameworkAsMSBuildRuntime)</GenerateResourceMSBuildRuntime>

Upvotes: 5

Bernhard Berbuir
Bernhard Berbuir

Reputation: 11

I have had the same problem and discovered that I am using a hack in one of the projects for handling a large number of resource files (If your build fails with “MSB6002: The command-line for the “ResGen” task is too long”).

After removing all attributes that are not supported by the version 3.5 of the task (GenerateResource Task) my build is working again.

Upvotes: 0

Related Questions