Skip to content

Instantly share code, notes, and snippets.

@kek-Sec
Created February 3, 2023 08:00
Show Gist options
  • Save kek-Sec/8a731c4240fdd07e8f8c704e11ea95c3 to your computer and use it in GitHub Desktop.
Save kek-Sec/8a731c4240fdd07e8f8c704e11ea95c3 to your computer and use it in GitHub Desktop.
Nuget Naming & Build on Post Build
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<!-- do not run if not release -->
<PropertyGroup>
<IsRelease Condition="'$(Configuration)' == 'Release'">true</IsRelease>
</PropertyGroup>
<!-- place nuget package one folder up from root in a folder called nuget -->
<Exec Command="dotnet pack -c Release -o nuget -p:PackageVersion=$([System.DateTime]::Now.ToString(&quot;yyyy.MM.dd.HHmmss&quot;)) --no-build" Condition="'$(IsRelease)' == 'true'" />
<Message Text="Package created " />
<!-- print build summary -->
<Message Text="Build summary:" Importance="high" />
<Message Text=" Configuration: $(Configuration)" Importance="high" />
<Message Text=" TargetFramework: $(TargetFramework)" Importance="high" />
<Message Text=" Platform: $(Platform)" Importance="high" />
<Message Text=" OutputPath: $(OutputPath)" Importance="high" />
</Target>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment