Create a New NuGet Server
- Open Visual Studio. Go to File> New> Project... to create a new project. From the templates, select ASP.NET Empty Web Application, as follows
- Now, we'll use the official NuGet repository to add NuGet.Server to our project. Right-click on References and select Manage NuGet Packages... Search for NuGet.Server and click Install.
Creating the .nuspec file and .nupkg file
nuget spec NugetTest
nuget pack NugetTest.nuspec
The Sample NugetTest.nuspec file will be as follow
<?xml version="1.0"?>
<package >
<metadata>
<id>NugetTest</id>
<version>1.0.0</version>
<authors>amila</authors>
<owners>amila</owners>
<licenseUrl>http://LICENSE_URL_HERE_OR_DELETE_THIS_LINE</licenseUrl>
<projectUrl>http://PROJECT_URL_HERE_OR_DELETE_THIS_LINE</projectUrl>
<iconUrl>http://ICON_URL_HERE_OR_DELETE_THIS_LINE</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Package description</description>
<releaseNotes>Summary of changes made in this release of the package.</releaseNotes>
<copyright>Copyright 2017</copyright>
<tags>Tag1 Tag2</tags>
<dependencies>
<dependency id="SampleDependency" version="1.0" />
</dependencies>
</metadata>
</package>
Push the package into server
nuget push NugetTest.1.0.0.nupkg -Source http://localhost:54163/nuget amila
- Here “amila” is the apikey that we configured in web.config file
- Open NUGET manager by right click on project and click setting wheel
**publish end point is authenticated via api key, but nuget has to be secured at network level








No comments:
Post a Comment