Automate publishing a project's nuget package during build process.
$ dotnet add package SS.NuGet.PublishAutomate publishing a project's NuGet package during build process.
To use the package, you need to add the SS.NuGet.Publish NuGet package to your project. Then configure accordingly in the .csproj file.
-SkipDuplicate command line option for nuget push command.NuGetPublishPathNuGetPublishType = remote OR NuGetPublishLocation starts with http, it executes nuget.exe using push command to NuGetPublishLocation as the sourceNuGetPublishType = local OR NuGetPublishLocation does not start with http, it executes nuget.exe using add command to NuGetPublishLocation as the sourceNuGetPublishType disables the auto-detection of publishing type.Note:
IfNuGetPublishLocationis not defined, no publish is attempted.
IfNuGetPublishTypeis set to remote, thenNuGetPublishLocationbe a valid URL to a NuGet repo. If is set to local, then be a valid local folder or UNC path. If you're publishing to a remote site, like NuGet.org, you will need to set your API Key prior to publishing. Follow the to learn how to accomplish this.
NuGetPublishTypeNuGetPublishLocation<PropertyGroup>
<NuGetPublishType>remote</NuGetPublishType>
<NuGetPublishLocation>https://api.nuget.org/v3/index.json</NuGetPublishLocation>
</PropertyGroup>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<NuGetPublishLocation>D:\references\packages</NuGetPublishLocation>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<NuGetPublishType>remote</NuGetPublishType>
<NuGetPublishLocation>https://api.nuget.org/v3/index.json</NuGetPublishLocation>
</PropertyGroup>
</project>