To start using NuGet Packages in your Sitefinity CMS projects, you need to install the Telerik.Sitefinity.All NuGet package with the respective version of your project. After the installation is complete, your project will automatically have the following modifications:
New packages.config file that contains the list of packages referenced by the project.
New ~/packages folder that contains all the NuGet packages used by the project.
As Sitefinity CMS has its own public feed for NuGet packages, you need to add it in the NuGet Package Manager Settings with the highest priority.
To do so, perform the following in Visual Studio:
In the toolbar, navigate to Tools » NuGet Package Manager » Package Manager Settings » NuGet Package Manager » Package Sources.
Add a new Sitefinity NuGet source by clicking the plus button.
Name: Sitefinity Nuget
If not already present, add a new source with the official NuGet package repository
Name: NuGet Official Package Source
To install the Sitefinity NuGet packages, you can use NuGet with either Package Manager UI or Package Manager Console in Visual Studio. The following sections provide steps for how to install NuGet packages with either one of the options.
The following steps are valid for Visual Studio 2015 and 2017.
In Visual Studio, perform the following:
In the Solution Explorer, right click on your solution and select Manage NuGet Packages for Solution
Open the Browse tab page and search for Telerik.Sitefinity.All
From the search results list, select the Telerik.Sitefinity.All package
On the right, you can specify options for the NuGet package before installing it, such as version, authors, license and dependencies of the package
Select the project where you want the NuGet package to be installed
6. Click Install and wait for NuGet to resolve the dependencies of the package.
7. Review the license of the packages and wait until the packages are installed.
8. Build your solution.
In the toolbar, navigate to Tools » NuGet Package Manager » Package Manager Console.
In Package source, select Sitefinity NuGet feed
In Default project, select the empty project that you created
In the console, enter Install-Package Telerik.Sitefinity.All -Version 11.0.6700.0
4. Wait until Sitefinity CMS is installed on your empty project.
5. Build your solution.
Congratulations, you are now using NuGet packages!
To have a cleaner developer environment and a smaller project size for your Source Control, you can configure the NuGet Package Restore. Package restore ensures all project dependencies are available without storing those packages in the source control. To see a list with the Source Control Management Solution versions, see Omitting NuGet packages in source control systems. NuGet keeps its packages in a local cache on your machine and the next time a missing package is detected, NuGet searches the Cache folder first before downloading another package from the internet. For more information, see Managing the Global Packages, Cache and Temp folders.
You can enable Package Restore directly from Visual Studio. To do so, navigate to Tools -> Options -> NuGet Package Manager -> General and select the following checkboxes:
Allow NuGet to download missing packages.
Automatically check for missing packages during build in Visual Studio.
If you happen to use multiple Sitefinity CMS instances and upgrading projects one at a time is not your thing, you can update them all at once using NuGet packages from a single Visual Studio Instance.
All you need to do is include your Sitefinity projects in a single solution and update the NuGet packages. The diagram below illustrates the Bulk Update Process from the Package Manager UI.
For the Package Manager Console, you have to specify each project where you want NuGet packages to be updated by using the following command:
Get-Project SitefinityWebApp1, SitefinityWebApp2, SitefinityWebApp3 | Update-Package Telerik.Sitefinity.All -Version 11.0.6700.0
From now on, your project is using NuGet packages and the upgrades will be easy. You won’t need the Sitefinity Project Manager to do this or add references manually. For more information on how to upgrade to the next Sitefinity version with click of a button, check out our other blog post—NuGet Packages: The Recommended Way to Upgrade Sitefinity CMS Websites.
View all posts from The Progress Team on the Progress blog. Connect with us about all things application development and deployment, data integration and digital business.
Subscribe to get all the news, info and tutorials you need to build better business apps and sites
Copyright © 2019 Progress Software Corporation and/or its subsidiaries or affiliates.
All Rights Reserved.
Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks for appropriate markings.