Tailwind Logo

Change from MyGet to NuGet

CLIRelated Technology

Published: 2023-07-31

The package manager used by Sitecore's tools has changed from MyGet to NuGet. This article introduces the scope of the impact and the procedures to be followed.

From MyGet to NuGet

We have been using MyGet as our package manager, but this month it has been replaced by NuGet.

  • Sitecore Install Framework
  • Sitecore Docker Tools
  • CLI Tools
  • SDK Module and etc

If you use nuget in the future, you may not have to worry about it, but if you are already using it, you will need to switch it over.

Delete MyGet settings

First, delete the SitecoreRegistory when using MyGet.

PowerShell
Unregister-PSRepository -Name SitecoreGallery
myget2nuget01.png

Then uninstall the module.

PowerShell
Uninstall-Module -Name SitecoreDockerTools -AllVersions
myget2nuget02.png

XM Cloud Project Changes

In this case, we will change the settings listed for XM Cloud. If other SDKs have nuget.config files, you can use them by changing the Package Source as follows.

XML
  <packageSources>
    <clear />
    <add key="Nuget" value="https://api.nuget.org/v3/index.json" />
    <add key="Sitecore" value="https://nuget.sitecore.com/resources/v3/index.json" />
  </packageSources>

Also in init.ps1 there is code that reads myget. # Rewrite the part of the code in Check for Sitecore Gallery as follows

PowerShell
# Check for Sitecore Gallery
Import-Module PowerShellGet
$SitecoreGallery = Get-PSRepository | Where-Object { $_.SourceLocation -eq "https://nuget.sitecore.com/resources/v2/" }
if (-not $SitecoreGallery) {
    Write-Host "Adding Sitecore PowerShell Gallery..." -ForegroundColor Green
    Unregister-PSRepository -Name SitecoreGallery -ErrorAction SilentlyContinue
    Register-PSRepository -Name SitecoreGallery -SourceLocation https://nuget.sitecore.com/resources/v2/ -InstallationPolicy Trusted
    $SitecoreGallery = Get-PSRepository -Name SitecoreGallery
}

This change completes the part that works with the new nuget.

Summary

In some of the articles we have blogged so far, old projects use myget in some cases. Please change those parts to use the new URL of nuget as needed.

Related article

Tags