1

Having an issue with a ResGen call during a build of a .NET 2.0 project from within Visual Studio .NET 2010, this thread suggests:

Add this to your MSBUILD command-line: /p:ResGenExecuteAsTool=true;ResGenToolArchitecture=ManagedIL;ResGenTrackerSdkPath="%programfiles(x86)%\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools\x64"

I've searched for hours without success trying to find a way to do this from within my Visual Studio .NET project.

Therefore my question is:

How can I change the MSBUILD command line of a .NET 2.0 (class library) project in Visual Studio 2010?

I have no fear changing my ".csproj" file, I would prefer not to change MSBuild files that were shipped with Visual Studio, if this is possible.

Update and solution:

Thanks to Oded's comment and answer, I added the following two lines:

<ResGenTrackerSdkPath>%programfiles(x86)%\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools\x64</ResGenTrackerSdkPath>
<TrackFileAccess>false</TrackFileAccess>

right inside the very first <PropertyGroup> section of my ".csproj" file (i.e. after line 3). This made the file compile successfully!

I now check and see whether it also runs successfully.

Community
  • 1
  • 1
Uwe Keim
  • 39,551
  • 56
  • 175
  • 291
  • 1
    You should be able to simply add these as properties in the project file. `%programfiles(x86)%\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools\x64` etc... – Oded Sep 10 '12 at 15:22
  • Wonderful, that did it! Would you mind posting this as an answer so I can accept it? :-) – Uwe Keim Sep 10 '12 at 15:24

1 Answers1

3

Like all properties in MSBuild, what you can pass in through the command line can be added in the project file in XML elements instead.

For example:

<ResGenTrackerSdkPath>%programfiles(x86)%\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools\x64</ResGenTrackerSdkPath>

And:

<ResGenExecuteAsTool>true</ResGenExecuteAsTool>

etc...

Oded
  • 489,969
  • 99
  • 883
  • 1,009