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

◇◆丶佛笑我妖孽 提交于 2019-12-08 06:51:16

问题


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.


回答1:


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...



来源:https://stackoverflow.com/questions/12354625/how-to-change-the-resgen-command-line-in-a-vs-net-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!