Quantcast
Channel: Visual Studio Integrate forum
Viewing all articles
Browse latest Browse all 4410

VS Single-file generators: how to add registry information?

$
0
0

I'm trying to figure out how to get a single-file generator installed on VS2010. Previously I got it sort-of working on VS2013 after many hours of head-banging; in both cases the primary difficulty is setting up the registry entries. Apparently VSIX files don't allow registry settings:

You can use the VSIX format to package project and item templates, Visual Studio Integration Packages, Managed Extensibility Framework (MEF) components, toolbox controls, assemblies, and custom types. The VSIX format uses strictly file-based deployment and does not support writing to the Global Assembly Cache (GAC), or to the system registry. VSIX is the preferred deployment method for the extension types that it supports.

My VS2013 solution involves the CodeGeneratorRegistrationAttribute and ComVisible(true)on the assembly, but after install, the extension doesn't work until the user runs devenv.exe /setupin Administrator mode. In VS2010, CodeGeneratorRegistrationAttribute does not exist in any of the SDK DLLs and simply adding the source code of CodeGeneratorRegistrationAttribute.cs to the project (as the Single File Generator sample does) doesn't seem to work (and I don't understand why the sample seems to expect it to work; .NET doesn't use structural typing, after all, so how could this attribute possibly have any effect?)

If a VSIX cannot add registry settings directly, I think a reasonable substitute is to include some code that automatically runs on VS startup. That code could find out the path of the registry hive of the running VS version and add the necessary registry settings at that time. So I have three questions:

  1. How can I cause a method written by me, inside my extension, to run when VS starts?
  2. How can I get the path of the current VS registry hive?
  3. Is there any other way to add the registry information?

I originally posted this question on StackOverflow with a 100 bounty but it didn't attract any answers.


Viewing all articles
Browse latest Browse all 4410

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>