MSBuild Batch File - Custom Task Parameter

461 Views Asked by At

How can I access custom parameter in my MSBuild?

For example, this is a call:

 msbuild.exe /t:CustomTask /p:CustomParameterName="Some Value Here"

And I want to access in task like this:

<Target Name="CustomTask">  
  <PropertyGroup>
    <CustomParameterName>NONE</CustomParameterName>
  </PropertyGroup>
  <Message Text="Parameter Value: $(CustomParameterName)" Importance="high" />
</task>

...or anyhow, just like a variable sent trough the batch file while I'm calling MSBuild.exe

1

There are 1 best solutions below

0
ShP On

Solved the issue:

<PropertyGroup> <CustomParameterName>NONE</CustomParameterName> </PropertyGroup>

This need to be defined outside of task.