带有项目模板和 NuGet 包的 VSIX [英] VSIX with Project Templates and NuGet Packages

查看:69
本文介绍了带有项目模板和 NuGet 包的 VSIX的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在关注这篇关于如何构建将添加一些自定义 MVC 项目类型的 VSIX 项目的帖子:

I have been following this post about how to build a VSIX project that will add some custom MVC project types:

http://www.asp.net/mvc/tutorials/mvc-4/custom-mvc-templates

我还想包含一些额外的 Nuget 包,所以我关注了 此页面来自Nuget,但它似乎适用于 VS2010,我在 2012 年工作.

I also want to include some additional Nuget packages, so I was following this page from Nuget, but it seems to be for VS2010 and I'm working in 2012.

我有项目建设,在我的机器上一切正常.安装成功,出现新的项目类型,当我创建这个类型的新项目时,一切正常.

I have the project building, and everything works peachy on my machine. The install works, the new project type appears, and when I create a new project of this type, everything works perfectly.

但是,当我将安装程序发送给同事时,事情就坏了.安装程序工作,他们看到新的项目类型,但在创建项目时,他收到关于无法在扩展节点中安装任何包的错误消息.我已经确认扩展的产品 ID 是正确的(我在测试过程中故意在 .vstemplate 文件中对其进行了格式错误,并给出了完全不同的错误).我已将这些包添加到扩展清单中,但似乎没什么区别.我还确认 .nupkg 文件已部署到 %ProgramFiles(x86)%\Microsoft Visual Studio 11.0\Common7\IDE\Extensions.

However, when I send the installer to a coworker, things break. The installer works, they see the new project type, but when creating the project he gets error messages about not being able to install any of the packages in the extension node. I've confirmed the Product Id of the extension is correct (I intentionally malformed it in the .vstemplate file during testing and it gave an entirely different error). I've added the packages to the extension manifest, but it doesn't seem to make a difference. I've also confirmed the .nupkg files get deployed to %ProgramFiles(x86)%\Microsoft Visual Studio 11.0\Common7\IDE\Extensions.

有什么建议吗?

自定义项目的 .vstemplate 部分

<WizardExtension>
    <Assembly>NuGet.VisualStudio.Interop, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</Assembly>
    <FullClassName>NuGet.VisualStudio.TemplateWizard</FullClassName>
</WizardExtension>
<WizardData>
    <packages repository="registry" keyName="AspNetMvc4VS11" isPreunzipped="true">
        <package id="EntityFramework" version="5.0.0" skipAssemblyReferences="true" />
        <package id="jQuery" version="1.8.2" />
        <!-- snip -->
    </packages>
    <packages repository="extension" repositoryId="SampleExtensionId">
      <package id="Unity" version="3.0.1304.0" targetFramework="net45" />
      <package id="Unity.WebAPI" version="0.10" targetFramework="net45" />
      <!-- snip -->
    </packages>
</WizardData>

source.extension.vsixmanifest 资产标签

<Assets>
    <Asset d:VsixSubPath="ProjectTemplates\CustomMVCTemplate" etc/>
    <Asset Type="Unity.3.0.1304.0" Path="Packages\Unity.3.0.1304.0.nupkg" />
    <Asset Type="Unity.WebAPI.0.10" Path="Packages\Unity.WebAPI.0.10.nupkg" />
    <!-- snip -->
</Assets>

文件结构

  • 扩展项目
    • 套餐
      • NugetPackage 1
      • NugetPackage 2
      • 自定义MVC模板
        • <自定义项目文件>

        推荐答案

        我制作了一个分步视频,介绍如何制作自动下载 nuget 包的 VSIX.

        I've made a step by step video on how to make a VSIX that auto downloads nuget packages.

        http://www.youtube.com/watch?v=_ZvsFz41H-E

        由于步骤很多,我没有写下来,这里就不打了.我肯定已经在其他人的机器上测试过我的 VSIX 包并且它有效,所以希望这对你有用.

        Since there are many steps and I never wrote them down, I won't type them here. I've definitely tested my VSIX package on other people's machine and it worked so hopefully this will work for you.

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

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