I have a VSPackage built in VS2010 that I need to port to VS2012. I need to continue supporting both versions of VS with the same code base. My package includes a custom editor that makes heavy use of the most excellent XmlEditor classes (XmlStore, XmlModel, etc) from the Microsoft.VisualStudio.XmlEditor.dll assembly. When I debug the package in VS2012, I'm not able to obtain the XmlEditorService due to a cast exception in the following line:
var editorService = (XmlEditorService)this.GetService(typeof(XmlEditorService));Presumably this is because the package is referencing v10 of the XmlEditor assembly and the shell is returning a type from v11 of the XmlEditor assembly. I can see both versions of the XmlEditor assembly are loaded (shown in the Modules window).
So, I guess the question is what is the prescriptive guidance on how to deal with this situation? We're not using an VS2012-specific functionality in our package, so logically we should be able to target both VS versions with one code base. I imagine we'll encounger more assemblies like the XmlEditor.
Thanks very much in advance.