Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

How to get Visual Studio installation directory


5 replies to this topic

David Harrington

David Harrington
  • Full Members
  • 3 posts

Posted 30 October 2008 - 16:12

Hi,

I'm using Visual Studio 2008 to create an installer for a Visual Studio package and need to get the Visual Studio installation directory and copy it into a property (e.g. from an environment variable such as VS90COMNTOOLS, or preferably from the registry) so that some files that my package installs to it are put in the correct directory.

For the moment, I've assumed that Visual Studio is always installed under:

[ProgramFilesFolder]\Microsoft Visual Studio 9.0...

however obviously this isn't a safe assumption.

I know that I need to create a custom action type 51 to do this, and I can do this using an MSI editor, but is there any way to add this either using the Visual Studio interface or a custom action in a DLL? I guess I can use the MsiSetProperty function from C#. but I don't think the MSIHANDLE can be got from C# which makes it sort of tricky. The only other way I can see is to use a batch file to do the whole thing...

Does anyone have any suggestions how this can be done?

Thanks in advance,

Dave Harrington.

VBScab

VBScab
  • Full Members
  • 436 posts

Posted 05 November 2008 - 12:28

At what stage do you want to know that, before installing your product?

- Don't know why 'x' happened? Want to know why 'y' happened? ProcMon will tell you.
- Try using http://www.google.com before posting.
- I answer questions only via forums. Please appreciate the time I give here and don't send me personal emails.

David Harrington

David Harrington
  • Full Members
  • 3 posts

Posted 06 November 2008 - 11:22

Sorry if I didn't make this clear enough - these properties need to be set during installation, so that I can install some files in the correct directory under the Visual Studio directory structure - there are some project and item templates, a DLL and an XML Schema - all of which I'm installing in various sub-directories of the Visual Studio installation. So ideally, I would have access to a property (which would be got from the registry, or perhaps an environment variable) which would allow me to install these files in the correct sub-directory.

VBScab

VBScab
  • Full Members
  • 436 posts

Posted 06 November 2008 - 12:00

I don't think the VS editor allows direct access to the MSI tables or offers a UI to them.

In that case, you'll need to use a direct editor like Orca or InstEd to edit the AppSearch table. AppSearch searches for folders, files or registry entries and sets properties according to the presence of those entities. You can then use the property to set your directory. In your case, I guess you'd be searching for the main VS executable.

Have a browse on MSDN for AppSearch. It's pretty straightforward. As ever, retain a copy of the MSI which VS spits out before you start hacking at the tables.
- Don't know why 'x' happened? Want to know why 'y' happened? ProcMon will tell you.
- Try using http://www.google.com before posting.
- I answer questions only via forums. Please appreciate the time I give here and don't send me personal emails.

Zweitze

Zweitze
  • Full Members
  • 522 posts

Posted 07 November 2008 - 11:18

If you want to find the installfolder of VS, just check out another VS package. Just open it.

I did exactly that "Visual Studio 2005 extensions for Windows Sharepoint services verrsion 1.1":
1. I started the downloaded executable with parameter /?. You get a list, look for the extract option.
2. Now use that extract option.
3. Open the MSI in Orca (part of Platform SDK)

In that case the MSI had an Appsearch filiter on a registry location. Remember that this was VS 2005, but it shouldn't be different on VS 2008.

David Harrington

David Harrington
  • Full Members
  • 3 posts

Posted 12 November 2008 - 15:05

Thanks for all the responses; I think the best solution would be to use other installation software as Visual Studio is very limited in this respect however that's not really practical for this project.
The solution I'm going to adopt for the moment, which I don't like as it is a bit more hacky than I'm happy with, is to install the files into the target directory then run a custom action to install the files into the correct directory, and obviously delete the files upon uninstallation. It will work, however, which is the main issue.

Thanks,

Dave.