Difference between revisions of "Create and Publish Nuget Packages"

From Logic Wiki
Jump to: navigation, search
(Created page with "Category:Tips Category:Server Category:IIS <div style="float:right;">__TOC__</div> == Getting Started == * Download [NuGet.exe https://dist.nuget.org/win-x86-comm...")
 
 
Line 5: Line 5:
  
 
== Getting Started ==
 
== Getting Started ==
* Download [NuGet.exe https://dist.nuget.org/win-x86-commandline/latest/nuget.exe]
+
* Download [https://dist.nuget.org/win-x86-commandline/latest/nuget.exe NuGet.exe ]
* Make sure NuGet.exe is in your path
+
* 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
  
  
Line 12: Line 35:
 
== Related Pages ==
 
== Related Pages ==
 
[Nuget Server Installation]
 
[Nuget Server Installation]
 +
== Related Links ==
 +
[https://docs.nuget.org/create/creating-and-publishing-a-package https://docs.nuget.org/create/creating-and-publishing-a-package]

Latest revision as of 11:13, 19 May 2016

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