How do I need to edit a *.csproj
file to add a PostBuildEvent on Mac?
I am trying the following but it doesn't work:
<ItemDefinitionGroup>
<PostBuildEvent>
<Command>echo Hello</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
Then I invoke dotnet build -f net6.0-maccatalyst
and the event isn't called.
CodePudding user response:
What you probably want is:
<PropertyGroup>
<PostBuildEvent>echo Hello</PostBuildEvent>
</PropertyGroup>
CodePudding user response:
The PropertyGoup
approach as mentioned works, but you can also create a new target like the following if need to add more than just a simple message.
<Target Name="MyAfterBuild" AfterTargets="Build">
<Message Importance="high" Text="Hello from MyAfterBuild" />
</Target>