Sitecore DLL management with Nuget

When working with a team of developers on a Sitecore project, you’ll want everyone to reference the same version of the Sitecore DLL’s in your solution. Keeping everyone on the same version of the DLL’s when an update to Sitecore occurs and automating the deployment of this can be done using Nuget.

The approach outlined below packages Sitecores DLL’s into a nuget package, and sets CopyLocal to false for all non Content Delivery environments.

This means that deploying a new version to an environment will require you to go through the Sitecore installer; but deployments to the Content Delivery server will deploy the correct DLLs (which normally is a manual step in Sitecore upgrades).

The solution is as follows:

- Make sure that your VS solution has configurations for each environment and that the Content Delivery ones are named ending in “CD” e.g. UATCD.
- Create a nuget package of the Sitecore dlls using NuGet Package Explorer.
- Set the Version number for the particular version of Sitecore e.g. “Sitecore.8.0.0.151127” and add all of the Sitecore dlls to the lib folder of the nuget package.
- Right click, and select “Add Tools Folder” to the package.
- Right click this, and select “Add Install.ps1”.
- edit the ps1 (powershell) file with the following.
- deploy to your nuget server and reference it in your project.