templatesvisual-studio-2013nugetsidewaffle

Add Nuget packages to a multi-project Sidewaffle template


I have a basic multi-project template created with Sidewaffle in VS2013 as per the guide here;

https://github.com/ligershark/side-waffle/wiki/How-to-create-a-multi-project-template

I'm struggling to find accurate steps to add all the NuGet dependencies to my templated sub projects. The instructions from the following are seemingly out of date and refer to a prior VSIX format (VS 2013 is using v2.0);

http://docs.nuget.org/create/packages-in-visual-studio-templates

I'm guessing my sub templates should have all their nuget packages and references removed prior to making them into a template. Then I need to modify them once templated to ensure the wizard adds the required NuGet packages to the solution when the user installs the template. This step doesn't seem to be documented anywhere.


Solution

  • The 2.0 schema tag should look like this:

    <Asset d:Source="File"
           Type="System.Collections.Immutable.1.1.33-beta.nupkg" 
           Path="Packages\System.Collections.Immutable.1.1.33-beta.nupkg" 
           d:VsixSubPath="Packages" />
    

    And yes, you should author your project template such that it does not have any references or packages.config file that installing the NuGet package(s) would have put there. As your template is expanded on your customer's machine, the NuGet custom wizard will run and add the packages.config and references to the project.

    Both of your questions were excellent, so I filed a couple pull requests to update the docs with the answers:

    1. 2.0 schema sample
    2. Removing references that NuGet will add