Produce nuget package on build

28 views
Skip to first unread message

jma...@microsoft.com

unread,
Nov 11, 2014, 8:21:08 PM11/11/14
to nuget-e...@googlegroups.com, alex...@microsoft.com, sriv...@microsoft.com

In our SDK we are shipping we have a project template that produces a nuget package on build.  To accomplish this we take a dependency on the Nuget.CommandLine package and have this line in the csproj file

 

<PostBuildEvent>if exist Diagnostic.nuspec if exist "$(SolutionDir)\packages\NuGet.CommandLine.2.8.3\tools\NuGet.exe" "$(SolutionDir)\packages\NuGet.CommandLine.2.8.3\tools\NuGet.exe" pack Diagnostic.nuspec -OutputDirectory .</PostBuildEvent>

 

Downsides to this approach are

  • If the user updates the version of NuGet package then it will silently no longer build

  • If the user renames Diagnostic.nuspec then it will silently no longer build

  • If the user removes NuGet.CommandLine package then it will silently no longer build

 

We can remove the if-clauses so the user get a build error in these cases, but I was wondering if there is any supported way to produce a nuget package on build?

 

Thanks,

 

Jon

Anton Chelnokov

unread,
Nov 12, 2014, 1:58:45 PM11/12/14
to nuget-e...@googlegroups.com, alex...@microsoft.com, sriv...@microsoft.com
Enable download packages on build and use "$(SolutionDir)\.nuget\NuGet.exe" as executable.

Or you can install nuget at developer machine and add it`s bin to %PATH%

Or u can create your package containing with fixed nuget.cml version in dependencies.
and install this package in your projects. 
also u can add build task to project on package install (i do not how but it posible, i think...)


среда, 12 ноября 2014 г., 4:21:08 UTC+3 пользователь jma...@microsoft.com написал:
Reply all
Reply to author
Forward
0 new messages