Please install R# as a pkgdef file for VS2010

Hello,

It'd be great if ReSharper was installed as a .pkgdef file in VS2010. Those files are merged at runtime into the registry by VS, that way you don't have to register R# to the registry directly.
The advantages would be a cleaner installation, and above all, the ability to load R# only for the instance I like. I'm currently developping a Visual Studio add-in and I don't want R# to be loaded into the Experimental Instance (devenv.exe /RootSuffix Exp) when debugging the addin, but I still want to be able to write code with ReSharper in the normal instance. With pkgdef, a simple move of the file from the VS program files directory to the local appdata (and a properly configured devenv.pkgdef file) for the normal instance would do the trick.

Thanks,

--
Julien Lebosquain

7 comments

Hello,

Sure we tried VSIX and all that .manifest and .pkgdef things. In fact, ReSharper
Preview for VS2010 Beta 1 released in summer had only that mode. The problem
is that not everything is possible (or known) for deployment in that mode.
For example, installing ReSharper for VS2008 and VS2010 would require lots
of ugly tricks. We are still considering doing .vsix installation, but it
depends on the time we have and if Microsoft would help us do what we want.

Sincerely,
Ilya Ryzhenkov

JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"


IR> Hello,
IR>
IR> It'll be great if ReSharper was installed as a .pkgdef file in
IR> VS2010. Those file are merged at runtime into the registry by VS,
IR> that way you don't have to register R# to the registry directly.
IR>
IR> The advantages would be a cleaner installation, and above all, the
IR> ability to load R# only for the instance I like. I'm currently
IR> developping a Visual Studio add-in and I don't want R# to be loaded
IR> into the Experimental Instance (devenv.exe /RootSuffix Exp) when
IR> debugging the addin, but I still want to be able to write code with
IR> ReSharper in the normal instance. With pkgdef, a simple move of the
IR> file from the VS program files directory to the local appdata (and a
IR> properly configured devenv.pkgdef file) for the normal instance
IR> would do the trick.
IR>
IR> Thanks,
IR>
IR> --
IR> Julien Lebosquain
IR> ---
IR> Original message URL:
IR> http://www.jetbrains.net/devnet/message/5250266#5250266


0

Thanks for your reply, Ilya.
Why not keep the registry installation for VS2008 and deploy a vsixmanifest/pkgdef for VS2010?

I'm not talking about a single .vsix for R# here (but that'll be great too); rather keeping the msi installer and writing the registry stuff to the registry in the case of VS2005/2008, and to a .pkgdef in case of VS2010. Just a suggestion though, you're knowing your product and limitations better than me In any case, I understand that it's not a critical 'feature' and there are still many things waiting to be fixed in R# 5.

That being said, I created a little pkgdef file containing only the package line (and deleted it from registry) so that I can enable R# only in my non-experimental instance. Works great so far as a workaround.

--
Julien Lebosquain

0

Hello,

Why did you install ReSharper into the Experimental Instance (devenv.exe
/RootSuffix Exp) too, in the first place?

From what you describe it seems that Registry actually fits your needs even
better because it's explicitly switched by the Experimental Hives control
and you do not have to copy or modify anything for it to work.


Serge Baltic
JetBrains, Inc — http://www.jetbrains.com
“Develop with pleasure!”


0

Hello Serge,

I didn't install it into the experimental instance, I just installed R# normally.

The experimental instance changed quite a bit in VS2010 according to Aaron Marten's blog (http://blogs.msdn.com/aaronmar/).
In VS2008, you could create your experimental hive in HKLM (or in HKCU with the /RANU switch) where you were free to delete/add whatever registry keys you liked.
In VS2010, the HKLM\Software\Microsoft\VisualStudio\10.0 is always used as a base, with or without /RootSuffix, this key is copied to HKCU\Software\Microsoft\VisualStudio\10.0Suffix_Config and pkgdef files are then merged into it at every devenv startup. It means that:

  • If I remove/add a key from HKLM\Software\Microsoft\VisualStudio\10.0 (in this case removing the R# package key), I'm affecting both my normal and experimental instance.
  • If I remove/add a key from HKCU\Software\Microsoft\VisualStudio\10.0Exp_Config, it'll be remerged from HKLM immediatly when I run devenv /RootSuffix Exp and my change will be lost.


Having struggled a few hours with those magically reappearing keys before finding Aaron Marten's blog, I went the pkgdef way:

  • I edited the master pkgdef file devenv.pkgdef to add $AppDataLocalFolder$\Extensions to the PkgDefSearchPath so that I could add local, instance-scoped .pkgdef files (I know that I could also have created a .vsixmanifest file referencing the .pkgdef files I needed - since those are automatically found by MEF - rather than making this change).
  • So far so good, any .pkgdef file was automatically merged to the registry and I could add keys.
  • But hey, I don't need to add keys... I want to remove them. So I searched around and found that .pkgundef files exist! However there's a big downside to this: VS2010 only reads the master devenv.pkgundef file. Unlike the .pkgdef files, there seems to be no search path and the only way to undefine registry keys are to put them in this master file... which is used by every instance, experimental or not. Arghh. Using process monitor to show file accesses on pkgundef file confirmed this.
  • Only one way was left: export the HKLM registry keys I wanted to be removed to a .pkgdef file, delete them from the registry and copy the pkgdef to the C:\Users\<user>\AppData\Local\Microsoft\VisualStudio\10.0\Extensions (edited: I wrote 10.0Exp instead of 10.0 in my original post) which I added to the search path in my first point. That's working like a charm: R# only loads for the normal instance. I would have to delete the package key the next time I install a new R# EAP but I can deal with it.


All those steps to get back to my point: things will really be easier if R# was installed as a .vsixmanifest/.pkgdef file in C:\Users\<user>\AppData\Local\Microsoft\VisualStudio\10.0\Extensions. That's what a .vsix file do. If you can't package ReSharper as a .vsix file which I understand perfectly (it's nice to have only one installer for every VS version), at least write a .pkgdef/.vsixmanifest during VS2010 installation rather than writing to HKLM. That way adding or removing R# to an experimental instance is just a matter of copying two files to another folder.

I'm now writing a small utility to automate this process. It will allow users to move a package from the registry to a pkgdef file and to configure which packages are loaded into the experimental instance.

Thanks for reading this block of text

--
Julien Lebosquain

0

Hi Justin,

I'm trying now, as well, to get Resharper out of the Exp Visual Studio, and I was very happy to find your awesome research on the subject.
However, I am having some issues that perhaps you could clarify:

...delete them from the registry and copy the pkgdef to the C:\Users\<user>\AppData\Local\Microsoft\VisualStudio\10.0\Extensions (edited: I wrote 10.0Exp instead of 10.0 in my original post) which I added to the search path in my first point. That's working like a charm: R# only loads for the normal instance. I would have to delete the package key the next time I install a new R# EAP but I can deal with it.


Which registry keys do you mean exactly? I assume it is something under: HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0_Config\Packages. However, the only related package I found ({0c6e6407-13fc-4878-869a-c8b4016c57fe}) I found which contains Resharper related packages did not seem to affect whether Resharper gets loaded or not. Once I reopened (the standard) devenv this key was recreated. What should I be deleting from the registry?

Also. When you said you copied the PkgDef file to the root (C:\Users\<user>\AppData\Local\Microsoft\VisualStudio\10.0\Extensions), did you mean the following file ReSharperRegistry.vs10.0.PkgDef from ReSharper's programfiles directory?

Thanks,
Vitaly

0

Hello Vitaly,

ReSharper is now installed as a pkgdef file so it's way easier than before to load it to only to the standard instance.

Discard all I said in my previous post and follow these instructions:

1) Go to <visual studio install dir>\Common7\IDE\Extensions\JetBrains\ReSharper\v5.1, you'll find two shortcuts.
2) Move (don't copy) those shortcuts to %localappdata%\Microsoft\VisualStudio\10.0\Extensions
3) Add $AppDataLocalFolder$\Extensions; to the "PkgDefSearchPath" in <visual studio install dir>\Common7\IDE\devenv.pkgdef

ReSharper will now only load for the normal instance. You can add and remove it to any other instance simply by copying those two shortcuts to %localappdata%\Microsoft\VisualStudio\10.0_<rootsuffix>\Extensions

Hope it helped,

--
Julien (not Justin ;))

0

Hi Julien******* :)

Thanks a lot for the detailed instructions!! It works flawlessly!

Thanks again,
Vitaly

0

Please sign in to leave a comment.