Skip to content

Instantly share code, notes, and snippets.

View JanisHuser's full-sized avatar

JanisHuser JanisHuser

View GitHub Profile
@tomcurran
tomcurran / test.csproj
Last active June 13, 2024 17:18
MSBuild Additional DefineConstants via property
<?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>