❔ MSBuild is it possible to set a additonal property?
Hello i tried already:
Main Project:
Project that referencing this ^^
But idk why i does not work
Do i use the right nuget packet?
Main Project:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<!-- Define a default value for EnableMyFeature, can be overridden by referencing project -->
<EnableMyFeature>false</EnableMyFeature>
</PropertyGroup>
<PropertyGroup Condition="'$(EnableMyFeature)' == 'true'">
<DefineConstants>$(DefineConstants);MY_CONSTANT</DefineConstants>
</PropertyGroup>
<!-- ... -->
</Project><Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<!-- Define a default value for EnableMyFeature, can be overridden by referencing project -->
<EnableMyFeature>false</EnableMyFeature>
</PropertyGroup>
<PropertyGroup Condition="'$(EnableMyFeature)' == 'true'">
<DefineConstants>$(DefineConstants);MY_CONSTANT</DefineConstants>
</PropertyGroup>
<!-- ... -->
</Project>Project that referencing this ^^
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
<!-- Override EnableMyFeature here -->
<EnableMyFeature>true</EnableMyFeature>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="path/to/LibraryProject.csproj">
<AdditionalProperties>EnableMyFeature=$(EnableMyFeature)</AdditionalProperties>
</ProjectReference>
</ItemGroup>
<!-- ... -->
</Project><Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
<!-- Override EnableMyFeature here -->
<EnableMyFeature>true</EnableMyFeature>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="path/to/LibraryProject.csproj">
<AdditionalProperties>EnableMyFeature=$(EnableMyFeature)</AdditionalProperties>
</ProjectReference>
</ItemGroup>
<!-- ... -->
</Project>But idk why i does not work
Do i use the right nuget packet?
<PackageReference Include="Microsoft.Build" Version="17.7.2" /> <PackageReference Include="Microsoft.Build" Version="17.7.2" />