0

I create a new custom project type using a VSPackage project inheriting of MPF library (http://mpfproj11.codeplex.com/). As a result I obtain a .vsix but I need add this project type using a .msi. I'm using the Visual Studio 2010 Setup projet for it. In my setup project I add the content of the VS Package in the same directory where the .vsix put then, but I think Ineed to put in the registre the new type of project because when I use the setup , the project template does not come out in Visual Studio and when I give double click the file with extension of the type of new project and does not recognize it. When I look the registry after install the vsix, this was one of the things that I found diferent. I add this entries in my setup project but It's not working yet.I'm missing something else?

enter image description here

In the projecttemplatedir is the directory where I put the .dll of the project type, the vsixmifest and pkgdef. The project template is in [User]\Documents\Visual Studio 2013\Templates\ProjectTemplates\[Name of new Project Type]\[projecttemplate.zip]

Best Regards

PS: The project type is for VS 2013 but I'm using the VS 2010 Setup project ;)

ocuenca
  • 38,548
  • 11
  • 89
  • 102
  • Why do you believe you need an MSI? Nothing you're showing us here needs an MSI...and I'd rather steer you away than go through all the issues in your authoring. – Jason Malinowski Dec 14 '13 at 22:23
  • Actually I take that back: I see you are also registering file types with the windows shell. – Jason Malinowski Dec 14 '13 at 22:26
  • I need an MSI because I install other things, like a dsl. But when I go to create a new project not appear,it's like don't load the project template – ocuenca Dec 14 '13 at 23:08
  • So It's necessary do anything else in the registry to register the custom project type or with entries that I show in figure should be enough? – ocuenca Dec 14 '13 at 23:26
  • My doubt is mostly in projecttemplatedir, I dont't know what it's means the last part(./ NullPath). In this page (http://msdn.microsoft.com/en-us/library/cc826178.aspx) is where I follow the stept to create the project type – ocuenca Dec 14 '13 at 23:33

2 Answers2

1

OK, so first the "don't"s of doing this:

In general, if you are installing via MSI you shouldn't be doing anything user-specific -- no writing in HKEY_CURRENT_USER, nor writing within their Documents folder, LocalAppData, or Visual Studio folders, etc. If you see yourself writing files or registry keys in either of those places, that should be your hint that there's a better way to do what you're trying to do. For what you've shown so far, this raises more than a few red flags for me.

Second, don't ever go writing keys into 12.0_Config. That part of the hive is nothing more than a cache that's built up from other parts of the registry and on-disk .pkgdef files from extensions. It's rebuilt in any number of senarios, including installing new extensions. Any writes there you should presume will get blown away at any time. If you need to write things there you should either (a) write in HKEY_LOCAL_MACHINE\Software\Microsoft\VisualStudio\[version] and run devenv /setup or (2) [preferred] put your keys in a .pkgdef inside your extension which gets merged into 12.0_Config for you automatically.

Now the dos:

You said you already had a .vsix produced by the SDK: you can put project templates in there. You can then register those templates in the .vsixmanifest and those will pull in. That's far easier than mucking around with files in Documents -- that's the user's directory...don't go playing with that.

Once you have a .vsix that does most of what you need, you should simply take the files within that and install the files in a folder within C:\Program Files [(x86)]\Microsoft Visual Studio 12.0\Common7\IDE\Extensions. Even better, you might just want to WiX toolset to build your installer, since it has built-in support for installing extensions. It also has built-in support for invoking the "/setup" process if that's what you need to do as well. Visual Studio Setup projects are no longer supported in newer versions of Visual Studio, so you're better off starting with a technology that isn't already obsolete. WiX is even what we use at Microsoft to do the setup work for Visual Studio itself, so it's definitely up to the task.

Last point: almost everything when it comes to Visual Studio extensibility can be done with a VSIX directly, so presume there's a good way to do something that way before falling back to an MSI. Internally, we can register the entire C# and VB language services with just a VSIX -- they're quite powerful.

Community
  • 1
  • 1
Jason Malinowski
  • 18,148
  • 1
  • 38
  • 55
  • Hi Jason, thanks for your great answer. The idea is install a graphic DSL (developed using DSL Tools) and a project type for it in the same installer. Is it possible do this in the same VSIX?. From the DSL project I obtain another VSIX,I mean, I have two extension to install. The problem also is that I have to put some dlls in Program Files, not is just install the extension. For that reason is that I'm using a Setup Project. – ocuenca Dec 16 '13 at 23:09
  • Why "must" the DLLs be in Program Files? – Jason Malinowski Dec 16 '13 at 23:27
  • Because there are extensions of the DSL using Dependency Injection, but is not obligatory put then in that directory, it was my decision. – ocuenca Dec 17 '13 at 00:10
  • Are you using MEF for the dependency injection or something else? MEF at least doesn't care where the assembly is on disk as long as it can be resolved somewhere. – Jason Malinowski Dec 17 '13 at 03:40
0

I found the answer in this link Registering Project and Item Templates. I set projecttemplatedir entry with [User]\Documents\Visual Studio 2013\Templates\ProjectTemplates[Name of new Project Type][projecttemplate.zip] that is where i put the project template.

ocuenca
  • 38,548
  • 11
  • 89
  • 102