- Create an ASP.NET web project with the Empty template
- Install the Nuget.Server package
- Publish the project to the IIS server
Connection
- Publish method: Web deploy
- Server: localhost (no port number)
- Site name: NugetServer (site name in IIS)
- Destination URL: http://localhost:8080 (site address)
Settings
- Configuration: Release
- Check “Exclude file from the App_Data folder”
- Create the .nuspec file for the project
nuget.exe spec
(run this command where the .csproj file is located)
-
Complete the data in the new file created
-
Build the project in Release mode and generate the nuget package with:
nuget.exe pack Project.csproj -Prop Configuration=Release
-
Copy the .nupkg file created into the Packages folder of the NugetServer
-
Configure the Nuget repository in VS
-
Tools -> Nuget Package Manager -> Package Manager Settings -> Package Sources
-
Add a new one
- Name: Local Server
- Source: http://localhost:8080/nuget
- Click on Update. OK
- Create a folder Tools in your solution and copy the nuget.exe file into it
- Create a Post-Build event in the project to create the nuget package automatically and move it to the Packages folder of the Nuget server
$(SolutionDir)/Tools/nuget.exe pack "$(ProjectPath)" -Prop Configuration=Release
if exist "$(TargetDir)*.nupkg" (
move "$(TargetDir)*.nupkg" \\NuGetServer\Packages\
)
Be sure that the version of the library has been incremented after the build. I use Automatic Versions