Sleet is a cross platform command line tool to generate NuGet v3 static feeds.
AppVeyor | Travis |
---|---|
CI builds are located on the following NuGet feed:
https://nuget.blob.core.windows.net/packages/index.json
The list of packages on this feed is here.
- Add and remove packages from a feed.
- Fast and stable - Sleet uses compressed static files.
- Azure storage support - Feeds can work directly with an azure storage account.
- Local folder support - Feeds can be written to disk and hosted with a web server to support authentication.
This solution uses .NET Core, get the tools here.
Download the latest release from github.
On Windows use Sleet.exe
OSX, Linux, and other OSes download and extract Sleet.tar.gz. To use Sleet run dotnet Sleet.dll
This guide is used to setup a new feed hosted on azure storage.
Create a sleet.json
config file to define a new package feed hosted on azure storage.
sleet createconfig --azure
Edit sleet.json
using your editor of choice to set the url of your storage account and the connection string.
notepad sleet.json
{
"sources": [
{
"name": "feed",
"type": "azure",
"path": "https://yourStorageAccount.blob.core.windows.net/feed/",
"container": "feed",
"connectionString": "DefaultEndpointsProtocol=https;AccountName=;AccountKey=;BlobEndpoint="
}
]
}
Now initialize the feed, this creates the basic files needed to get started. The source
value here corresponds to the name
property used in sleet.json
.
sleet init --source feed
Add packages to the feed with the push command, this can be used with either a path to a single nupkg or a folder of nupkgs.
sleet push d:\nupkgsToPush --source feed
Add the feed as a source to your NuGet.Config
file. In the example above the package source URL is https://yourStorageAccount.blob.core.windows.net/feed/index.json
This guide is used to setup a new feed hosted on a local IIS Webserver.
Create a sleet.json
config file to define a new package feed hosted on IIS.
sleet createconfig --local
Open sleet.json
using your editor of choice, the file will look like similar to this
notepad sleet.json
{
"username": "",
"useremail": "",
"sources": [
{
"name": "myLocalFeed",
"type": "local",
"path": "C:\\myFeed"
}
]
}
Edit the file so that path
contains the address of your webserver and the URI users will map to use the feed.
For example, if you want the mapped feed address to be https://example.com/feed/index.json
change path
to:
"path": "https://example.com/feed"
Now initialize the feed, this creates the basic files needed to get started.
- The
config
value here corresponds to the filesystem path to thesleet.json
file. - the
source
value here corresponds to thename
property used insleet.json
sleet init --config C:\sleet.json --source myLocalFeed
Sleet will create files for the feed in a new directory corresponding to the URI set in path, so if you changed path to https://example.com/feed
,
the files will be created in a directory named feed on you C:\
drive.
Add packages to the feed with the push command, this can be used with either a path to a single nupkg or a folder of nupkgs.
sleet push --config C:\sleet.json -s myLocalFeed C:\PackagesFolder
Create an empty ASP.NET Website project.
In the projects' web.config
file add the following lines:
<configuration>
<system.webServer>
<staticContent>
<mimeMap fileExtensions=".nupkg" mimeType="application/zip"/>
<mimeMap fileExtension="." mimeType="application/json"/>
</staticContent>
</system.webServer>
</configuration>
Publish your ASP.NET website to your IIS server.
Copy the entire C:\feed
directory to a path on your IIS server (including all subfolders).
In Internet Information Services Manager
open your website, right click and choose Add Virtual Directory
- In
Alias
enter the URI you want to expose - in our example it'sfeed
- In
Physical Path
enter the path on the server you copied yourC:\feed
directory to.
Add the feed as a source to your NuGet.Config file. In the example above the package source URL is https://example.com/feed/index.json
Check out the full getting started guide here.