Skip to content

Instantly share code, notes, and snippets.

@kazuk
Created March 5, 2013 09:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kazuk/5089069 to your computer and use it in GitHub Desktop.
Save kazuk/5089069 to your computer and use it in GitHub Desktop.
msbuild targets file for NuGet packaging & publish to local repos
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup >
<AvailableItemName Include="NuGetSpec">
<Visible>false</Visible>
</AvailableItemName>
</ItemGroup>
<PropertyGroup>
<NuGetRepository Condition="'$(NuGetRepository)' == ''">\\nugetrepos.local\NuGetRepos</NuGetRepository>
</PropertyGroup>
<Target Name="NuGetPackage"
AfterTargets="Build"
Inputs="@(NuGetSpec);@(FileWrites)"
Outputs="%(NuGetSpec.Identity).pkglog" >
<Exec Command="..\.nuget\Nuget.exe pack -OutputDirectory $(OutputPath) "
LogStandardErrorAsError="true" />
<ItemGroup>
<NuGetPackages Include="$(OutputPath)*.nupkg" />
</ItemGroup>
<WriteLinesToFile File="%(NuGetSpec.Identity).pkglog" Lines="@(NuGetPackages)"/>
</Target>
<Target Name="PushNuGetPackage" AfterTargets="NuGetPackage" >
<Copy SkipUnchangedFiles="true"
SourceFiles="@(NuGetPackages)"
DestinationFolder="$(NuGetRepository)" />
<Message Text="@(NuGetPackages) was copied to $(NuGetRepository)" />
</Target>
</Project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment