User-1330468790 posted
Hi robby32,
Will this take the value of teststr as test ?
No, it will not take the value as test since you don't define the constants at all.
By default, when you set "Configuration=debug", it actually defines two constants "DEBUG" and "TRACE".
You could refer to this link:
https://docs.microsoft.com/en-us/visualstudio/ide/understanding-build-configurations?view=vs-2019#project-configurations
That way, you are able to get the value of 'teststr' as "test" where the "DEBUG" works.
If you set "Configuration=Release", what you could get is "other" since "LIVE","DEBUG" and
"TEST" can not be found.
Instead, you could try below way to self-define the constants in command.
To get "live":
MSBuild.exe C:\Projects\Testing.sln /property:Configuration=Release /t:Rebuild /p:DefineConstants="LIVE"
To get "test"
MSBuild.exe C:\Projects\Testing.sln /property:Configuration=Release /t:Rebuild /p:DefineConstants="TEST"
OR
MSBuild.exe C:\Projects\Testing.sln /property:Configuration=Release /t:Rebuild /p:DefineConstants="DEBUG"
To get "other"
MSBuild.exe C:\Projects\Testing.sln /property:Configuration=Release /t:Rebuild /p:DefineConstants=""
You could read below documentations for more details.
sets the global Configuration property to DEBUG.
MSBuild command-line reference
Hope helps.
Best regards,
Sean