I can’t figure out how to pass values into an MSBuild task like I would a method. Take the following project file…
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0" DefaultTargets="Main">
<PropertyGroup>
<Var1>Foo</Var1>
<Var2>Bar</Var2>
</PropertyGroup>
<Target Name="Main">
<Message Text="$(Var1)" Importance="high" />
<Message Text="$(Var2)" Importance="high" />
</Target>
</Project>
I want to refactor the Message task into a target and then pass over Var1 and Var2 to it to get the same output. This is a very simplified example but the concept is the same.
I think you want to do something like this:
This produces the following output: