From 0156d23abfc645d6443da92ac2320d525ffd5b82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Sharma?= Date: Sun, 8 Sep 2019 22:56:05 -0700 Subject: [PATCH] Add NuGet.Server migration guide (#326) --- docs/tools/migrate.md | 39 +++++++++++++++++++++++++++++++++++++++ docs/vs/nugetserver.md | 4 ++-- mkdocs.yml | 1 + 3 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 docs/tools/migrate.md diff --git a/docs/tools/migrate.md b/docs/tools/migrate.md new file mode 100644 index 00000000..892c1785 --- /dev/null +++ b/docs/tools/migrate.md @@ -0,0 +1,39 @@ +# Migrate from NuGet.Server + +[NuGet.Server](https://github.com/NuGet/NuGet.Server) is a lightweight standalone NuGet server. It is strongly recommended that you upgrade to BaGet if you use NuGet.Server. Feel free to open a [GitHub issue](https://github.com/loic-sharma/BaGet/issues) if you need help migrating. + +!!! info + Please refer to the [BaGet vs NuGet.Server](../vs/nugetserver.md) page for reasons to upgrade to BaGet. + +# Steps + +Make sure that you've installed [nuget.exe](https://www.nuget.org/downloads). In PowerShell, run: + +```ps1 +$source = "" +$destination = "" +``` + +If you've [configured BaGet to require an API Key](https://loic-sharma.github.io/BaGet/configuration/#requiring-an-api-key), set it using [the `setapikey` command](https://docs.microsoft.com/en-us/nuget/reference/cli-reference/cli-ref-setapikey): + +```ps1 +& nuget.exe setapikey "NUGET-SERVER-API-KEY" -Source $destination +``` + +Now run the following PowerShell script: + +```ps1 +if (!(Test-Path "Web.config")) { + throw "Please run this script in the same directory as NuGet.Server's Web.config file" +} + +(& nuget.exe list -AllVersions -Source $source).Split([Environment]::NewLine) | % { + $id = $_.Split(" ")[0].Trim() + $version = $_.Split(" ")[1].Trim() + + $path = [IO.Path]::Combine("Packages", $id, $version, "${id}.${version}.nupkg") + + Write-Host "nuget.exe push -Source $destination ""$path""" + & nuget.exe push -Source $destination $path +} +``` diff --git a/docs/vs/nugetserver.md b/docs/vs/nugetserver.md index 1713a3a6..91b35a9d 100644 --- a/docs/vs/nugetserver.md +++ b/docs/vs/nugetserver.md @@ -16,6 +16,6 @@ * Cross-platform * Supports NuGet v3 APIs -## Upgrade Guide +## Migration Guide -TODO \ No newline at end of file +You can use the [NuGet.Server migration](../tools/migrate.md) guide to import your NuGet.Server packages into BaGet. \ No newline at end of file diff --git a/mkdocs.yml b/mkdocs.yml index 08056edd..2f744865 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -45,6 +45,7 @@ pages: - Tools: - Mirroring: tools/mirroring.md - BaGet SDK: tools/sdk.md + - Migrate from NuGet.Server: tools/migrate.md - BaGet vs. Other: - nuget.org: vs/nugetorg.md - NuGet.Server: vs/nugetserver.md