visual-studio - 如何构建面向 Visual Studio 2010-2017 的 Visual Studio 扩展 (VSIX)

标签 visual-studio visual-studio-2010 visual-studio-2015 visual-studio-extensions vsix

我们的构建环境是针对 .net 4.0 的 VS 2015(理想情况下)

我们刚刚根据 VS 2015 中的 Visual Studio 可扩展性项目模板重新设计了 Visual Studio 插件。生成的 VSIX 在 VS 2015 和 2017 RC1 上运行良好。

但是,我希望将 VSIX 的目标定为 VS 2010(最好是 2012 年)。这就是问题开始的地方......

  • VS 2010 使用 .net 4.0。
  • 我将编译器降至 .net 4.0
  • 无法加载 VS 2015 (4.5) 程序集(即 Microsoft.VisualStudio.Shell.14.0)。
  • 没关系,因为我没有使用其中的任何内容,因此我放弃了对它们的引用,转而使用 10.0 (2010) 版本。
  • 代码编译得很好。
  • 但 VSIX 包没有

1>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(1820,5): warning MSB3274: The primary reference "Microsoft.VisualStudio.Imaging, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" could not be resolved because it was built against the ".NETFramework,Version=v4.5" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.0".

所以问题似乎是,如果我以 VS 2010 为目标,我需要将其构建为 .net 4.0,但 VS 2015 构建脚本需要 .net 4.5。

我想知道是否可以在 VS 2015 项目中使用 VS 2010 构建工具?或者我必须将 VS 2015 项目转换回 VS 2010?

更新

开始认为由于其他原因这是不可能的......

https://learn.microsoft.com/en-us/visualstudio/extensibility/faq-2017

The new VSIX v3 format is backward compatible with VSIX v2, so you’ll still be able to have a single VSIX with a single VSIX ID that supports Visual Studio 2012 and later. The new VSIX v3 format does not support Visual 2010 and earlier. To support Visual Studio 2010 onward, you will need to create a separate extension (with a separate VSIX ID).

最佳答案

我遇到了类似的问题,所以我创建了一个名为 VsixUpdater 的 Nuget 包,如果添加到 VSIX 项目,它可以自动执行 VSIX 迁移,它甚至可以与旧版本的 Visual Studio 一起使用(我用 2012 年测试过)添加包后,生成的 VSIX 包将兼容 V3 和 2017,请参阅 https://github.com/axodox/VsixUpdater了解详情。

关于visual-studio - 如何构建面向 Visual Studio 2010-2017 的 Visual Studio 扩展 (VSIX),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42269556/

相关文章:

vb.net - 如何更改表单中所有标签的前景色?

c# - SQL插入命令只在一个循环中工作一次

git - 了解 Git for Visual Studio 2015 : Revert

windows - 如果没有桌面 session ,devenv.com 将无法启动

javascript - 有没有一种方法可以在两个 AngularJS Web 解决方案与 Visual Studio 之间共享 javascript 代码?

javascript - 如何使用 Visual Studio 将 typescript 网站发布到 GitHub Pages?

python - 有没有办法更改 Visual Studio Code 中编辑器的只读设置?

visual-studio - AnkhSVN:如何将不在解决方案下的文件添加到 SVN? (VS 2010)

visual-studio-2010 - 创建本地化的 WIX 3.6 Bootstrap 。

debugging - Visual Studio 2017 企业诊断工具不再显示事件