NuBuild icon indicating copy to clipboard operation
NuBuild copied to clipboard

Custom version

Open ASEC-bdubas opened this issue 10 years ago • 1 comments

Hi

I try to create solution level package and control it version manually. I try various options available in the NuBuild but any of them is relevant for my case.

  • Auto - i can control only the third number
  • Library - i do not have any reference DLL nor other file.
  • Manual - is not the case while i have more than one nuspec files to manage.

I investigate the possibilities and i think the best could be us ein nu spec $vesrion$ source Library and in the MSBuild project file set the Version property to some value. I found that i can use the replaceable for any MSBuild property so such option available for $version$ will be great extension point.

ASEC-bdubas avatar Oct 27 '14 16:10 ASEC-bdubas

Hi again,

I found the solution is a little tricky but works.

In the nuproj file i add the target that deal with metadata before Build.

<Target Name="Version" BeforeTargets="BeforeBuild">
  <ItemGroup>
    <NuPrepared>
      <NuPackageVersion>$(Version)</NuPackageVersion>
      <NuPackagePath>$(MSBuildProjectDirectory)\$(OutputPath)%(NuPrepared.Filename).$(Version).nupkg</NuPackagePath>
    </NuPrepared>
  </ItemGroup>
</Target>

Where Version property is generated before this target.

This ware possible because of separation of tasks Prepare and Package.

I leave the issue opened, may other have something to add. If its OK to do such things (in terms of support in the feature) it could be closed.

ASEC-bdubas avatar Oct 28 '14 10:10 ASEC-bdubas