ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

Add VS2012 compatibility for existing VS2010 extension packages

2019-08-11 16:35:31  阅读:291  来源: 互联网

标签:extension package VS2012 VS2010 VS Exp your


原文链接:http://www.cnblogs.com/Cherubimlee/archive/2013/04/02/2995870.html

If you already created and are maintaining an amazing VSPackage in VS2010, and you want adapt your package to newer VS2012, meanwhile you want to keep your package works with both VS2010 and VS2012, the first idea come to my eye is to migrate all code from VS2010 to VS2012 and maintaining two versions of code, one for VS2010 and one for VS2012.

Right, it is correct and absolutely workable. However, maintaining two versions costs lot. You may ask, is there any other way to do that to make our life easier? The answer is “Yes”. In this blog, I will introduce a way to make VS2012 load the package which is designed for VS2010. And give a way to configure a debug environment which you can build your package using VS2010 (for compatible reason) and debug the package using VS2010 and VS2012 Exp Hive.

Adapt VSIX to be compatible with VS2010 and VS2012

As we know, starting with VS2010, it is recommend to use VSIX to deploy the VS Packages. VSIX is a zip based the package and it contains a XML based configuration file, vsixmanifest file. Normally we define the supported VS editions via vsixmanifest designer. If we right click on vsixmanifest file and view code, we can check all the xml configurations. For the supported VS editions, it looks like

 

    <SupportedProducts>

      <VisualStudio Version="10.0">

        <Edition>Pro</Edition>

      </VisualStudio>

    </SupportedProducts>

 

What we need to do is to add support for VS2012, which is version “11.0” as following:

    <SupportedProducts>      
       <VisualStudio Version="10.0">        
          <Edition>Pro</Edition>      
       </VisualStudio>      
       <VisualStudio Version="11.0">        
          <Edition>Pro</Edition>      
       </VisualStudio>    
    </SupportedProducts>

Now we can save and build the package. When we launch the VSIX, you we will find the VSIX will scan all installed VS (Both VS2010 and VS2012) and let you choose which version you will deploy the package.  

 

Configure a debug environment which you can build your package using VS2010 and debug the package using VS2010 and VS2012 Exp Hive.

Using above way we can deploy the package to VS2012, we can attach the debugger from VS2010 to VS2012 to debug the code for sure. However, for some reasons, we still want to debug our package on VS2012 Exp hive and make everything runs well before we deploy the package to VS2012 normal hive.

According to Dissecting VS 2010 Package Registration, the solution is given and the solution is also applied to VS2012. In addintion, we need to call devenv /rootsuffix Exp /Setup or devenv /updateConfiguration from VS2012 to make VS load our package. The steps summarized as

  1. Copy your package assembly to a subdirectory under …<user>\AppData\Local\Microsoft\VisualStudio\12.0Exp\Extensions
  2. Create and copy a pkgdef and vsixmanifest to the same directory
  3. Launch VS2012’s devenv /rootsuffix Exp /Setup or  devenv /updateConfiguration
  4. Launch VS2012’s devenv with ‘/rootsuffix Exp’ command line switch
  5. Enable the package via the ‘Tools.Extension Manager’

Here devenv /updateConfiguration is an undocumented command line which is much faster than /Setup, but it will be subject to change and not guarantee to work with feature VS release. And I found enable package in one time action, we don’t need to uninstall it to update the code.

The solution is not too complex, we can create an after build script, either vbscript or msbuild to run these steps after we build the code in VS2010.

Above is all material today. Thank you for your time for my first VSX Blog. If you have any question or anything I’m wrong, please leave your comments/feedbacks or send email to me (Cherubimlee@hotmail.com)

A Chinese version will be post soon.

转载于:https://www.cnblogs.com/Cherubimlee/archive/2013/04/02/2995870.html

标签:extension,package,VS2012,VS2010,VS,Exp,your
来源: https://blog.csdn.net/weixin_30312659/article/details/99201735

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有