Skip to content

SimplerSoftware/SS.NuGet.Publish

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SS.NuGet.Publish

Automate publishing a project's NuGet package during build process.

Build status

Usage

To use the package, you need to add the SS.NuGet.Publish NuGet package to your project. Then configure accordingly in the .csproj file.

Project file properties

  • NuGetPublishVersion (Optional)
    • Version of Nuget.exe to use. Defaults to 6.8.0
  • NuGetPublishPath (Optional)
    • Path to cache the Nuget.exe locally. Defaults to %UserProfile%\.nuget\{NuGetPublishVersion}\
  • NuGetPublishType (Optional)
    • Either remote or local. Will try to auto detect if NuGetPublishLocation is a url (begins with http), defaults to local if NuGetPublishLocation is not a url.
  • NuGetPublishLocation
    • Valid URL or path to publish the NuGet package to
  • NuGetPublishSkipDuplicate
    • Set to true to add the -SkipDuplicate command line option for nuget push command.

How it works

  • If not already cached, it will download a copy of nuget.exe from https://dist.nuget.org/win-x86-commandline/v{NuGetPublishVersion}/nuget.exe into NuGetPublishPath
  • Publish
    • If NuGetPublishType = remote OR NuGetPublishLocation starts with http, it executes nuget.exe using push command to NuGetPublishLocation as the source
    • If NuGetPublishType = local OR NuGetPublishLocation does not start with http, it executes nuget.exe using add command to NuGetPublishLocation as the source
    • Manually setting NuGetPublishType disables the auto-detection of publishing type.

Note:
If NuGetPublishLocation is not defined, no publish is attempted.
If NuGetPublishType is set to remote, then NuGetPublishLocation must be a valid URL to a NuGet repo.
If NuGetPublishType is set to local, then NuGetPublishLocation must 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 instructions here to learn how to accomplish this.

Examples

<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>

About

Automate publishing a project's NuGet package during build process.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors