A build target that packs and publishes the project to a private nuget server.
$ dotnet add package MSBuild.PublishNuget.Target🎯⚙️ MSBuild.PublishNuget.Target is a NuGet package that automates the process of packing and publishing your .NET Framework project as a NuGet package to a private NuGet server.
[!Important]
- This package is designed for .NET Framework projects and does not support .NET Core or newer frameworks.
- It requires the
nuget.exeexecutable to be available in your system's PATH.
.nupkg files during the build process.Install the package via NuGet Package Manager Console:
Install-Package MSBuild.PublishNuget.Target
Or visit the NuGet package page for more information.
nuget.exe executable is installed and available in your system's PATH.
nuget help. If the version information is displayed, you're ready to go.nuget.exe is not installed, download the latest version from the NuGet Downloads Page.Add the NuGet package to your project.
Open your .csproj file and add the following configuration:
<PropertyGroup><PropertyGroup>
<PackageAPIKey>{{YOUR PRIVATE NUGET FEED KEY}}</PackageAPIKey>
<PackageServer>{{YOUR PRIVATE NUGET FEED URL}}</PackageServer>
<PackageDir>{{DIRECTORY TO GENERATE THE .NUPKG}}</PackageDir>
<PackageIncludeReferencedProjects>true</PackageIncludeReferencedProjects>
</PropertyGroup>
Replace the placeholders with the following:
PackageAPIKey: Your private NuGet feed API key.PackageServer: The URL of your private NuGet feed.PackageDir: Directory where the .nupkg file will be generated.PackageIncludeReferencedProjects: Set to true to include referenced projects, or false to exclude them (defaults to false if omitted).Save the .csproj file.
In Visual Studio, set the current build configuration to Release.
Build the project.
.csproj file as described.Release mode..nupkg file will be published to your private NuGet feed.Contributions are welcome!
Feel free to submit issues, feature requests, or pull requests to improve this project.
This project is licensed under the MIT License.