Migrate to PackageReference from packages config

Few days back i was working on to upgrade the Sitecore project to use PackageReference instead of packages.config and the migration was smooth except one glitch.

There are several advantages we get with PackageReferences, few of them are as follows:

  1. Faster package install and update times.
  2. Ability to manage all project dependencies from single place (project file).
  3. Top-level view of dependencies, the project file shows only those NuGet packages you directly installed in the project.

When moved to PackageReferences you are going to get rid off packages.config and all references are going to be part of project file.


The references which we see above with packages.config will be removed and gets added to project file just like any other file in the project.


Above screen shot shows how it looks when it gets added to project file.

Another advantage we get with PackageReference is that all the packages gets referred from global folder instead of having separate packages folder for all the solutions and this overall improves the performance and save some disc space as well.

Migrate to PackageReference from packages.config

If you already have a solution that is based on packages.config follow the below steps to make it compatible with PackageReference.

  1. Go to Tools ->Options- > Nuget Package Manager and change the Default package management format to “PackageReference“, we have two options there- Packages.config and PackageReference.packageformat
  2. Once the format is change to PackageReference, you can go to the project which you want to migrate and click on packages.config.
  3. Right click on packages.config and click on Migrate packages.config to PackageReference.migrate
  4. You can also click on References and get to the same option to migrate.migratescreen
  5. It would list down all the top level dependencies and transitive dependencies and also shows if there are any compatibility issues with the migration.
  6. Once you see everything is ok to proceed, click on OK, it might take few seconds to migrate and generate the backup folder before migrating the project which gets added to the solution root for you to roll back if required.
  7. Once the migration is completed- we can see the changes there:packagereferencedone

Another important thing to note here, PackageReference option is available with Visual Studio 2017 and later.


I got one issue while migrating to PackageReference, related to project not eligible for migration.


Everything looks fine to me, after spending some time i was able to fix this issue by following the below suggestion:


Overall i feel it’s worth to migrate to PackageReference  considering the advantages we get with it over packages.config, i would say definitely give it a try.

Hope this helps!

Happy learning 🙂






One thought on “Migrate to PackageReference from packages config

  1. Shyam January 20, 2021 / 10:50 am

    Thanks for this. Helped me a lot


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s