Created
June 27, 2011 21:41
-
-
Save radleta/1049910 to your computer and use it in GitHub Desktop.
NuGet Package and Publish Example for MSBUILD
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |
<PropertyGroup> | |
<!-- snip --> | |
<PackageDir>Package\$(Configuration)</PackageDir> | |
</PropertyGroup> | |
<!-- snip --> | |
<Target Name="AfterBuild"> | |
<!-- Load up the information from the assembly --> | |
<GetAssemblyIdentity AssemblyFiles="$(OutputPath)$(AssemblyName).dll"> | |
<Output TaskParameter="Assemblies" ItemName="OutputAssemblyInfo" /> | |
</GetAssemblyIdentity> | |
<Message Text="Info: %(OutputAssemblyInfo.Version)" /> | |
</Target> | |
<Target Name="Package"> | |
<!-- Ensure the Package directory exists for this project --> | |
<RemoveDir Directories="$(PackageDir)" /> | |
<MakeDir Directories="$(PackageDir)" /> | |
<!-- Package the project --> | |
<Exec WorkingDirectory="$(BuildDir)" Command="NuGet.exe pack -Symbols -OutputDir "$(PackageDir)" -Version %(OutputAssemblyInfo.Version)" /> | |
</Target> | |
<Target Name="Publish"> | |
<!-- Publish the nupkg to the well known NuGet server | |
Note: "nuget setApiKey {put-your-api-key-here} -Source http://My_Nuget_Gallery_Service_Url/" must be run prior on the machine to ensure the api key is set correctly. --> | |
<Exec WorkingDirectory="$(PackageDir)" Command="NuGet.exe push "$(AssemblyName).%(OutputAssemblyInfo.Version).nupkg" -Source http://My_Nuget_Gallery_Service_Url/" /> | |
</Target> | |
</Project> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment