MSBuild的,定义条件编译符号符号、定义、条件、MSBuild

2023-09-02 10:28:23 作者:一眼看去全是二货

我可能只是盲目的,但有一个命令行中MSBUILD指定条件编译符号?

I'm possibly just blind, but is there a command line to specify conditional compilation symbols in MSBUILD?

目前,我有我的buildscript这一行:

I currently have this Line in my buildscript:

SET MSBUILD=C:WINDOWSMicrosoft.NETFrameworkv2.0.50727MSBuild.exe
SET CONFIG=Debug
%MSBUILD% /p:Configuration=%CONFIG% /p:OutputPath=....output sourceMyProjectMyProject.csproj

和我想补充一个条件。在Visual Studio中,我可以去到项目属性=>生成=>条件编译符号,但我还没有看到该选项的MSBuild的?

And I'd like to add a condition. In Visual Studio, i can just go into Project Properties => Build => Conditional compilation symbols, but I have not seen that option for msbuild?

奖金噶如果你知道,如果我可以完全覆盖在.csproj的文件中已作规定的所有符号,以确保只有从我Buildscript的条件语句进去的。

Bonus Karma if you know if I can completely override all symbols already specified in the .csproj files to make sure that only the conditionals from my Buildscript go in.

推荐答案

你见过this? (大多数信息是在倒数第二后)

Have you seen this? (most info is in the penultimate post)

/p:DefineConstants="MYSYMBOL1;MYSYMBOL2"