将 Nuget 包添加到多项目 Sidewaffle 模板 [英] Add Nuget packages to a multi-project Sidewaffle template

查看:71
本文介绍了将 Nuget 包添加到多项目 Sidewaffle 模板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据此处的指南,我在 VS2013 中使用 Sidewaffle 创建了一个基本的多项目模板;

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

我正在努力寻找将所有 NuGet 依赖项添加到我的模板化子项目的准确步骤.以下说明似乎已过时,并参考了以前的 VSIX 格式(VS 2013 使用的是 v2.0);

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-视觉工作室模板

我猜我的子模板应该在将它们变成模板之前删除它们的所有 nuget 包和引用.然后我需要在模板化后修改它们,以确保在用户安装模板时向导将所需的 NuGet 包添加到解决方案中.这一步似乎没有记录在任何地方.

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.

推荐答案

2.0 架构标签应该如下所示:

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" />

是的,您应该创作您的项目模板,使其没有安装 NuGet 包会放置在那里的任何引用或 packages.config 文件.当您的模板在客户的计算机上展开时,NuGet 自定义向导将运行并将 packages.config 和引用添加到项目中.

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 架构示例
  2. 删除 NuGet 将添加的引用

这篇关于将 Nuget 包添加到多项目 Sidewaffle 模板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆