How can I pass a custom MsBuild property to Visual Studio build engine from Visual Studio Extension (I want to write a custom add-in) ? Just like Visual Studio itself is passing properties like $(Configuration)
and $(Platform)
, I would like to attach to a build process and pass my own property (e.g. $(MyCustomProperty) = "foobar"
). I know it can be accomplished using MsBuild command line (/p:Property
), but I want to do it from an extension.
Here is an example of what I would like to accompilsh: a textbox on visual studio toolbar, where user can type in some text - a value, that I would like to pass to build engine.
Then in .csproj:
<PropertyGroup>
<MyCustomProperty Condition=" '$(MyCustomProperty)' == '' ">DefaultValue</MyCustomProperty>
</PropertyGroup>
<Target Name="AfterBuild" Condition=" '$(MyCustomProperty)' = 'DoAfterBuild' ">
...
</Target>
So target AfterBuild
would be exectued only if user typed DoAfterBuild
into my extension's text box