First, the Nuget CLI needs to be installed on your machine. Place the .exe in a folder and add that folder to your local path. The nuget CLI exe can be found here:
https://dist.nuget.org/
Run the following command one time to set the api key permanently for your nuget server.
nuget setApiKey yourapikey -source http://yournugeturl
Change directories to where your .csproj file is located and run this command:
nuget spec
The command above will generate a nuspec file. Edit the nuspec file and delete or fill in any elements without $. The $'s indicate variables that will be automatically replaced during the pack process. Do not change those elements.
Next edit your assembly info for your project:
Edit /properties/AssemblyInfo.cs using Visual Studio
In the assembly info file you'll find all the properties for your project. I recommend that you let Visual Studio supply the build and revision numbers (so 1.0.*) as mentioned in the comments in this file. Make sure other values are set to your liking.
Next, from a command prompt, run the following command:
nuget pack
This will package up your project and create a .nupkg file for upload to the nuget server. Now you're ready to push your package to the server. Run the following command and you're done:
nuget push yourpack.nupkg -source http://yournugeturl
No comments:
Post a Comment