调用 devenv 时传递 MSBuild 选项

发布于 2024-10-02 15:53:49 字数 50 浏览 0 评论 0原文

有没有办法将命令行开关传递给 devenv,然后在调用 MSBuild 时按原样传递?

Is there a way to pass command line switches to devenv which are then passed as-is when it calls MSBuild?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

逆光飞翔i 2024-10-09 15:53:49

您绝对可以通过 msbuild 的 /property (/p) 键来实现此目的。
以文本形式打开 .csproj(使用 notepad.exe):像 $(somename) 这样的所有组合都是 msbuild 的属性。它们可以通过 /p:somename=somevalue 在 msbuild 的命令行中传递,但也可以通过环境变量传递给 devenv。
例如:启动 Visual Studio 命令提示符,在命令提示符中键入:

set semename=somevalue

devenv

Visual Studio 将启动。加载您选择的解决方案,属性“somename”将传递到该解决方案中的所有项目,其值为“somevalue”。

You definitely can achieve this for /property (/p) key of msbuild.
Open .csproj in as text (with notepad.exe): all combinations like $(somename) are properties of msbuild. They can be passed in command line of msbuild via /p:somename=somevalue, but they also can be passed to devenv through environment variable.
For example: start Visual Studio Command prompt, in the command prompt type:

set semename=somevalue

devenv

Visual Studio will start. Load a solution of your choice, the property "somename" will be passed to all projects in this solution with the value "somevalue".

南七夏 2024-10-09 15:53:49

为什么不直接调用 MSBuild

msbuild solution.sln /property:Configuration=Debug

Why don't you call MSBuild directly?

msbuild solution.sln /property:Configuration=Debug
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文