Create and Publish Nuget Packages

From Logic Wiki
Jump to: navigation, search

Getting Started

  • Download NuGet.exe
  • Make sure NuGet.exe is in your path [SET PATH]

Creating a Package from Project

  • In the folder where the csproj file is, run:
nuget spec

This creates a special nuspec file with tokens meant to be replaced at pack time based on the project metadata.

If you want to explicitly define which files are included in the package, you can use a node in the nuspec. e.g. suppose you want to add all the files from some arbitrary other folder into the package, you'd have:

<files>
   <file src="..\..\SomeRoot\**\*.*" target="" /> 
</files>
  • Once your nuspec is ready, you can run:
nuget pack MyProject.csproj

or

nuget pack MyProject.csproj -Prop Configuration=Release

Publishing Nuget Package

Local

nuget push {package file} -s http://servername/Nuget/nuget {apikey}

api key : [Nuget Server Installation]

package file : ProjectName.1.0.0.0.nupkg

Remote

nuget push YourPackage.nupkg



Related Pages

[Nuget Server Installation]

Related Links

https://docs.nuget.org/create/creating-and-publishing-a-package