How to pass dynamic properties to an MSbuild task?
This question was kindly answered on StackOverflow. For anyone else looking for an answer:

&lt;PropertyGroup&gt;
  &lt;BuildParameters&gt;
    Configuration=Debug;
    Platform=Any CPU;
        SomeOtherProperty=Foo
  &lt;/BuildParameters&gt;
&lt;/PropertyGroup&gt;
…
&lt;PropertyGroup&gt;
  &lt;!-- this property can even be extended afterwards, e.g. when a condition is needed --&gt;
  &lt;BuildParameters Condition=" '$(ShallAppendThings)' == 'true' "&gt;
    $(BuildParameters);
    AnotherProperty=SomeValue
  &lt;/BuildParameters&gt;
&lt;/PropertyGroup&gt;
…

&lt;MSBuild Projects="$(SolutionFile)" Targets="Build" Properties="$(BuildProperties)" /&gt;


source:
https://stackoverflow.com/questions/46226120/how-to-pass-dynamic-properties-to-an-msbuild-task