May 03, 2016 | Charlie Turano
A new feature we added to TDS 5.5 is the ability to create and consume NuGet packages in your TDS project. This allows developers to capture their Sitecore items and easily distribute them across multiple teams.
One of the ways we use this at Hedgehog Development is to distribute common base templates that are part of an implementation involving multiple sub-sites. The base templates are kept in a NuGet package and distributed via a private NuGet server. A TDS project incorporates the NuGet package to serve as referenced project for code generation. The TDS project with the items in the NuGet package should not be deployed, since they are not part of the sub-site.
Creating the NuGet package is pretty simple. I will describe the steps below:
1) Add the NuGet Command Line package to your solution. The reason for this is that TDS needs the NuGet tools to build the NuGet package. The NuGet Command Line package needs to be added to a non-TDS project in your solution.
2) Enable NuGet package generation in TDS. This is done in the NuGet Package property page by checking the “Generate NuGet Package” checkbox.
3) Provide the path to the NuGet.exe command that was added to the project is step 1 in the “Path to NuGet.exe” text box. This should be a relative path if you are using Automated Builds.
4) Fill in all required fields in the NuGet Package property page. You may also fill in any optional fields needed for your project. The definitions of these fields can be found in the NuGet documentation.
5) Build the TDS project.
6) Distribute the package.
Using a TDS NuGet package is also very simple.
1) Right click on the TDS project in the solution explorer and choose “Manage NuGet Packages…”
2) Select the NuGet package in the NuGet package manager
3) Click “Install” in the NuGet package manager.
Using NuGet packages to distribute your items to multiple project has a number of advantages. These include the ability to easily update the package and creating dependencies between packages. For more on this feature, check out our Feature Spotlight video.