How to change the Resgen command line in a VS.NET project?
Asked Answered
Z

1

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.

Zygophyllaceous answered 10/9, 2012 at 15:16 Comment(2)
You should be able to simply add these as properties in the project file. <ResGenTrackerSdkPath>%programfiles(x86)%\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools\x64</ResGenTrackerSdkPath> etc...Diane
Wonderful, that did it! Would you mind posting this as an answer so I can accept it? :-)Zygophyllaceous
D
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...

Diane answered 10/9, 2012 at 15:28 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.