Visual Studio 2013 和 MSBuild 命令行开关 [英] Visual Studio 2013 and MSBuild command line switches

查看:46
本文介绍了Visual Studio 2013 和 MSBuild 命令行开关的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法在 Visual Studio 2013 中指定像/p:option=value 这样的 msbuild 开关?

Is there a way to specify msbuild switches like /p:option=value within Visual Studio 2013?

推荐答案

从上面正式化我的评论.

Formalizing my comment from above.

一个可能的解决方案可能是拥有一个定义要覆盖的属性及其值的目标文件(例如 VisualStudioOverrides.targets).然后,如果此文件存在,则 csproj 文件将导入它,从而覆盖相关属性.这样的导入语句应该放在 csproj 文件的底部(在定义要覆盖的属性之后)并且看起来像:

A possible solution may be to have a targets file (e.g. VisualStudioOverrides.targets) that defines the properties to be overridden and their values. Then, if this file exists then the csproj file will import it, thus override the relevant properties. Such an import statement should be placed at the bottom of the csproj file (after the properties to be overridden were defined) and would look something like:

<Import Project="$(MSBuildProjectDirectory)\VisualStudioOverrides.targets" Condition="Exists('$(MSBuildProjectDirectory)\VisualStudioOverrides.targets')" />

这篇关于Visual Studio 2013 和 MSBuild 命令行开关的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆