Last active
June 13, 2024 17:18
-
-
Save tomcurran/c261ffaf77304d0f7dd51800abff7e24 to your computer and use it in GitHub Desktop.
MSBuild Additional DefineConstants via property
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |
<Target Name="DisplayMessages"> | |
<Message Text="Configuration: $(Configuration)" /> | |
<Message Text="DefineConstants: $(DefineConstants)" /> | |
<Message Text="AdditionalDefineConstants: $(AdditionalDefineConstants)" /> | |
</Target> | |
<PropertyGroup> | |
<DefineConstants>TEST</DefineConstants> <!-- this DefineConstants is optional --> | |
<DefineConstants Condition=" '$(AdditionalDefineConstants)' != '' ">$(DefineConstants);$(AdditionalDefineConstants)</DefineConstants> | |
</PropertyGroup> | |
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
msbuild test.csproj /t:DisplayMessages /p:Configuration=Release /p:AdditionalDefineConstants="Additional_Define_Constants_Here" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment