[英]How to change the Resgen command line in a VS.NET project?
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: 在Visual Studio .NET 2010中构建.NET 2.0项目期间遇到ResGen调用问题时, 此线程建议:
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"
将其添加到您的MSBUILD命令行:
/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. 我已经搜索了几个小时没有成功,试图从我的Visual Studio .NET项目中找到一种方法。
Therefore my question is: 因此我的问题是:
How can I change the MSBUILD command line of a .NET 2.0 (class library) project in Visual Studio 2010? 如何在Visual Studio 2010中更改.NET 2.0(类库)项目的MSBUILD命令行?
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. 我不担心更改我的“.csproj”文件,如果可能的话,我宁愿不更改Visual Studio附带的MSBuild文件。
Update and solution: 更新和解决方案:
Thanks to Oded's comment and answer , I added the following two lines: 感谢Oded的评论和回答 ,我添加了以下两行:
<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 (ie after line 3). 就在我的“.csproj”文件的第一个
<PropertyGroup>
部分内(即第3行之后)。 This made the file compile successfully! 这使文件编译成功!
I now check and see whether it also runs successfully. 我现在检查它是否也成功运行 。
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. 与MSBuild中的所有属性一样,您可以通过命令行传入的内容可以在XML元素的项目文件中添加。
For example: 例如:
<ResGenTrackerSdkPath>%programfiles(x86)%\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools\x64</ResGenTrackerSdkPath>
And: 和:
<ResGenExecuteAsTool>true</ResGenExecuteAsTool>
etc... 等等...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.