Answers: <p>This question was kindly answered on StackOverflow. For anyone else looking for an answer:</p>
  
  <pre><code>&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;
  </code></pre>
  
  <p>source:
  <a href="https://stackoverflow.com/questions/46226120/how-to-pass-dynamic-properties-to-an-msbuild-task">https://stackoverflow.com/questions/46226120/how-to-pass-dynamic-properties-to-an-msbuild-task</a></p>
  
Answers: CC BY-SA 3.0
Answers: 2017-09-15T14:02:55.227Z
Answers: 2017-09-15T14:02:55.227Z
Answers: nichos
Body: <p>Is it possible to pass a dynamic property group to an MSbuild task? So if I have the following properties and values:</p>
  
  <pre><code>&lt;MyPropertyGroup&gt;
     &lt;Foo&gt;bar&lt;/Foo&gt;
     &lt;Foo1&gt;bar1&lt;/Foo1&gt;
     &lt;Foo2&gt;bar2&lt;/Foo2&gt;
  &lt;/MyPropertyGroup&gt;
  </code></pre>
  
  <p>I could call MSBuild with a short property list:</p>
  
  <p><code>&lt;MSBuild Projects="$(SolutionFile)" Targets="Build" Properties="MyPropertyGroup" /&gt;</code></p>
  
  <p>But it would be the same as calling the task like this:</p>
  
  <pre><code>&lt;MSBuild Projects="$(SolutionFile)" Targets="Build" Properties="Foo=bar;Foo1=bar1;Foo2=bar2" /&gt;
  </code></pre>
  
  <p>This is helpful if there's a large property list, and allows for only 1 place needs to be maintained.</p>
  
Comments: CC BY-SA 3.0
Comments: 2017-09-13T08:55:45.540Z
Comments: How does it relate to a devops culture or tooling ? This sounds just a programming question...
Comments: Tensibai
Comments: CC BY-SA 3.0
Comments: 2017-09-13T15:42:08.703Z
Comments: You don't feel this is a devops question? DevOps includes builds and automation. Specifically this question is related to tools and infrastructure as code. Looking around devops.stackexchange there are several questions relating to automation, builds, jenkins, etc. It does cross the line, but when I think of infrastructure as code, I think devops rather than a stackoverflow question.
Comments: nichos
Comments: CC BY-SA 3.0
Comments: 2017-09-13T15:54:14.833Z
Comments: That's highly unclear from your question actually what the goal of this MSbuild is. Keep in mind that's your responsibility to avoid misconception when asking your tags are very vague and your question doesn't explain it is for infrastructure in any way
Comments: Tensibai
Tags: <automation><builds>
Title: How to pass dynamic properties to an MSbuild task?
UserDisplayName: nichos
ThreadText: # How to pass dynamic properties to an MSbuild task?
  
  (Asked by: username_0 on 2017-09-12)
  
  Is it possible to pass a dynamic property group to an MSbuild task? So if I have the following properties and values:
  
  ```
  <MyPropertyGroup>
     <Foo>bar</Foo>
     <Foo1>bar1</Foo1>
     <Foo2>bar2</Foo2>
  </MyPropertyGroup>
  
  ```
  
  I could call MSBuild with a short property list:
  
  `<MSBuild Projects="$(SolutionFile)" Targets="Build" Properties="MyPropertyGroup" />`
  
  But it would be the same as calling the task like this:
  
  ```
  <MSBuild Projects="$(SolutionFile)" Targets="Build" Properties="Foo=bar;Foo1=bar1;Foo2=bar2" />
  
  ```
  
  This is helpful if there's a large property list, and allows for only 1 place needs to be maintained.
  
  **Tags:** automation, builds
  
  > **Comments:**
  > **username_1**: How does it relate to a devops culture or tooling ? This sounds just a programming question...  
  > **username_0**: You don't feel this is a devops question? DevOps includes builds and automation. Specifically this question is related to tools and infrastructure as code. Looking around devops.stackexchange there are several questions relating to automation, builds, jenkins, etc. It does cross the line, but when I think of infrastructure as code, I think devops rather than a stackoverflow question.  
  > **username_1**: That's highly unclear from your question actually what the goal of this MSbuild is. Keep in mind that's your responsibility to avoid misconception when asking your tags are very vague and your question doesn't explain it is for infrastructure in any way  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2017-09-15. Score: 0 | Accepted answer
  
  This question was kindly answered on StackOverflow. For anyone else looking for an answer:
  
  ```
  <PropertyGroup>
    <BuildParameters>
      Configuration=Debug;
      Platform=Any CPU;
          SomeOtherProperty=Foo
    </BuildParameters>
  </PropertyGroup>
  …
  <PropertyGroup>
    <!-- this property can even be extended afterwards, e.g. when a condition is needed -->
    <BuildParameters Condition=" '$(ShallAppendThings)' == 'true' ">
      $(BuildParameters);
      AnotherProperty=SomeValue
    </BuildParameters>
  </PropertyGroup>
  …
  
  <MSBuild Projects="$(SolutionFile)" Targets="Build" Properties="$(BuildProperties)" />
  
  ```
  
  source:
  <https://stackoverflow.com/questions/46226120/how-to-pass-dynamic-properties-to-an-msbuild-task>
  
  
  ---
  
  