davidfowl / NuGetPowerTools

A bunch of powershell modules that make it even easier to work with nuget
http://nuget.org/List/Packages/NuGetPowerTools
84 stars 12 forks source link

Copy Package to Repository #18

Closed mdmoura closed 12 years ago

mdmoura commented 12 years ago

Hello,

I am using NuGetPowerTools to create Nuget Packages in 4 of my projects.

When the projects are built the packages are created and placed in /Project/Bin/Release as expected.

I am using a Local Package Repository and I would like to automatically publish these packages in it.

I am using Auto-Increment versions on assemblies and packages (1.0.date.revision).

The fourth build on January 08th, 2012 will have a version number of: 1.0.120108.03

So I have the following on my projects MSBuild scripts:

<!-- DELETE PREVIOUS PACKAGE VERSION -->
<Target Name="BeforeBuild">
  <ItemGroup>
     <Package Include="$(OutputPath)*.nupkg" />
  </ItemGroup>
  <Delete Files="@(Package)" />
</Target>

<!-- COPY NEW PACKAGE VERSION TO REPOSITORY -->
<Target Name="AfterBuild">
  <ItemGroup>
    <Publish Include="$(OutputPath)*.nupkg" Exclude="$(OutputPath)*.symbols.nupkg" />
    <Repository Include="C:\Team\Repository" />
  </ItemGroup>
  <Copy SourceFiles="@(Publish)" DestinationFolder="@(Repository)" />
</Target>

The problems I have:

1 - The new package is not copied to the repository.

Without Delete Files on BeforeBuild the packages are build and copied. All are copied but not the new one ...

It seems the package it is being created after the AfterBuild Copy task.

Is there a way to solve this?

2 - Is this functionality already available in NuGetPowerTools?

If yes, could you, please, give me an example?

Thank You, Miguel

davidfowl commented 12 years ago

You can just set the PackageOutputDir property in your project or pass it on the msbuild command line.