Since I made the last blog post on upgrading, I have received some good feedback that it was useful for basic scenarios. Unfortunately, there are some scenarios that sometimes the steps that I presented didn’t work because of hard dependency on Microsoft.VisualStudio.Shell.dll.
In this blog post, I will talk about how to upgrade your project if you cannot simply replace the Microsoft.VisualStudio.Shell.dll with Microsoft.VisualStudio.Shell.9.0.dll.
Things You Need to Do to your Project File
- Unload your package project file inside Visual Studio and edit the project file directly.
- Add <Reference Include=“Microsoft.VisualStudio.Shell“ /> back to your ItemGroup element. (Well, this is not really a step to help you make this work. This is more why you need this to be using this guide in the first place!)
- In the PropertyGroup element near the end of your project file, set UseVS2005MPF and RegisterWithRanu to true and false respectively. You will also need to set the TargetRegistryRoot property. Your file should look something like this:
- Next, save the project file and close it. Then, right-click on the project file and choose to reload the project.
- When the project is loaded up again, right-click on it and choose Properties. Select the Debug tab and remove “/ranu” from the Command line arguments field. Your Debug tab should now look like this:
At this point, you have told the build target that you want to use the 8.0 version of the MPF DLL. When you do that, we automatically use the matching 8.0 version of regpkg.exe to register your package. Of course, that’s the version that we shipped with VS 2005 SDK, and it didn’t support normal user package development, so we didn’t support RANU (run as normal user). So then, you need to set RegisterWithRanu = false. Finally, setting the TargetRegistryRoot is pretty straight forward. So with your updated package project, you will need to make sure you are running VS as admin in order to make it build successfully because it will now attempt to register the package under HKLM, just like we used to do in the VS 2005 SDK. But before you go and restart VS in admin mode, you first need to create your experimental hive under HKLM. If you remember, in VS 2008, we no longer create the experimental hive under HKEY_Local_Machine. We actually create the experimental hive under HKEY_Current_User and do smart detouring in order to enable package development for normal users. But now that you are going back to the old world, you will need to do everything as admin.
- Run a command prompt as an admin. Then, go to the directory where your VS 2008 SDK is installed and run “vsregex getorig 9.0 Exp”.
- Once this command is finished running, you can close VS and restart it in admin mode. You can do this by right-clicking on the VS icon and choose “Run as Administrator”.
Now, you should see your package build successfully and a new instance of VS should launch happily with your package registered!
It’s getting late; if I have missed anything, please let me know and I will update this post.