From a VSIP Package 2003 to VSIP Package 2005

I was converting some 2003 packages today so I gotta enumerate the most common tasks that you should do if you wanna do the same.

1- Delete all Microsoft.* references in your project.

2- Be sure to change the References Path (Project/Properties/References Path)  from VS 2003 to VS 2005.

3- Add References to the new interop assemblies, in general you need references to:

      - Microsoft.VisualStudio.Shell   ( In this assembly there are almost every class that was in the VSIP.Helper )

      - Microsoft.VisualStudio.Ole.Interop

      - Microsoft.VisualStudio.Shell.Interop

      - Microsoft.VisualStudio.Shell.Interop.8

      - Microsoft.VisualStudio.Package.Project

4- A lot of errors are because some needed class reorganization.

Constants in NativeMethods are migrated to Microsoft.VisualStudio.Shell.VsConstants

So I recommend you for example to find all NativeMethods.S_OK and replace for VsConstants.S_OK, etc

Calls to Win32 api that were in NativeMethods where moved to Microsoft.VisualStudio.Win32Methods,

for example   NativeMethods.SetParent --> Microsoft.VisualStudio.Win32Methods.SetParent

5 - Be careful because the signature of  InstalledProductRegistration changed. Idem for ProvideToolWindow.

6- You may consider to use ToolWindowPane (From the Managed Package Framework) as base of your toolwindows, an Microsoft.VisualStudio.Shell.Package as base of your Package.

7- As you probably know the way to handle commands in packages, toolwindows, editors in VSIP 2003 is by implementing IOleCommandTarget (QueryStatus and Exec), well in VSIP 2005 there is a newer elegant way to handle commands using OleMenuCommandService (you can see how to use it in the samples). The problem here is that convert this is not just change a name or a reference. So in this point you have to refactor the probably big case of your querystatus and exec methods.

Obviously there are more things but if you change these 7 points you have your work almost done.

Hope this help.

 

 

No Comments