PC Review
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET
Re: Visual Studio 2005 Installer Variables?
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET
Re: Visual Studio 2005 Installer Variables?
![]() |
Re: Visual Studio 2005 Installer Variables? |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
Hi Steve,
I you're using Visual Studio, in the Window for the Setup Registry, after creating the Key, right-click it and select "New " (whatever type of value). -- HTH, Kevin Spencer Microsoft MVP Software Composer http://unclechutney.blogspot.com In case of Minimalism, break Philip Glass. "Steve Barker" <stevebarker@nospam.nospam> wrote in message news:43301961-07A1-4BE2-B92A-F51C4C5655C2@microsoft.com... > Hi guys, > > Apologies if this is posted in the wrong please; if so, please let me know > and I'll re-post. (Apologies also for duplicating a post I made > previously; > I've had some problems with my passport account associations!) > > I've just written an installer using Visual Studio 2005, and as part of > the > install, I want to create some registry keys. I want the registry keys to > contain, amongst other things, the directory that the product was > installed > into. Creating registry keys using the installer is very easy, but I'm not > sure how to include installation specific information into these keys. Is > there some kind of variable I can use to get the values I require? I will > also need to do some string manipulation on these values. For instance, if > the installation location is "C:\Program Files\Test", I might need to > write > "C:\Program Files\Test\MyFile.txt" to the registry. > > Any help would be gratefully received! > > Many thanks, > > Steve. > |
|
|
|
#2 |
|
Guest
Posts: n/a
|
Hi Kevin, and thanks for your response.
I can already create registry keys and values through the installer. That is not the problem; apologies if my post was a little vague. (I think I was using the term "key" when really I meant "value"!) I want to set the information stored in the values dynamically, depending on where the installation path set by the user. Say I have a value called "Test" in my key. If the user decides to install to "C:\MyInstallations\Here", I want the Test value to be set to "C:\MyInstallations\Here\MyFile.txt", where as if the user chooses the default location, the Test value should be something like "C:\ProgramFiles\{CompanyName}\{Product}\MyFile.txt". I'm looking to be able to access variables that describe the installation location in order to set dynamic registry values. Many thanks, Steve. "Kevin Spencer" wrote: > Hi Steve, > > I you're using Visual Studio, in the Window for the Setup Registry, after > creating the Key, right-click it and select "New " (whatever type of value). > > -- > HTH, > > Kevin Spencer > Microsoft MVP > Software Composer > http://unclechutney.blogspot.com > > In case of Minimalism, break Philip Glass. > > "Steve Barker" <stevebarker@nospam.nospam> wrote in message > news:43301961-07A1-4BE2-B92A-F51C4C5655C2@microsoft.com... > > Hi guys, > > > > Apologies if this is posted in the wrong please; if so, please let me know > > and I'll re-post. (Apologies also for duplicating a post I made > > previously; > > I've had some problems with my passport account associations!) > > > > I've just written an installer using Visual Studio 2005, and as part of > > the > > install, I want to create some registry keys. I want the registry keys to > > contain, amongst other things, the directory that the product was > > installed > > into. Creating registry keys using the installer is very easy, but I'm not > > sure how to include installation specific information into these keys. Is > > there some kind of variable I can use to get the values I require? I will > > also need to do some string manipulation on these values. For instance, if > > the installation location is "C:\Program Files\Test", I might need to > > write > > "C:\Program Files\Test\MyFile.txt" to the registry. > > > > Any help would be gratefully received! > > > > Many thanks, > > > > Steve. > > > > > |
|
|
|
#3 |
|
Guest
Posts: n/a
|
Hi Steve,
I don't believe this can be done via the Setup and Deployment project tools in Visual Studio. It will probably be necessary for you to create a custom (unmanaged code, using the Windows Setup API - http://msdn2.microsoft.com/en-us/library/aa377657.aspx) Installer. You can read the Platform SDK reference here: http://msdn2.microsoft.com/en-us/library/aa372866.aspx The specific section on adding registry keys on the Installation or removal of an application is here: http://msdn2.microsoft.com/en-us/library/aa367530.aspx You would use the Installer Database to add the registry keys, and to get the information you need about the installation: http://msdn2.microsoft.com/en-us/library/aa369395.aspx Wish I had better news for you, but it looks like you have your work cut out for you. -- HTH, Kevin Spencer Microsoft MVP Software Composer http://unclechutney.blogspot.com In case of Minimalism, break Philip Glass. "Steve Barker" <stevebarker@nospam.nospam> wrote in message news:5F7C2CA7-3263-4FF6-829F-561B87229274@microsoft.com... > Hi Kevin, and thanks for your response. > > I can already create registry keys and values through the installer. That > is > not the problem; apologies if my post was a little vague. (I think I was > using the term "key" when really I meant "value"!) > > I want to set the information stored in the values dynamically, depending > on > where the installation path set by the user. Say I have a value called > "Test" > in my key. If the user decides to install to "C:\MyInstallations\Here", I > want the Test value to be set to "C:\MyInstallations\Here\MyFile.txt", > where > as if the user chooses the default location, the Test value should be > something like "C:\ProgramFiles\{CompanyName}\{Product}\MyFile.txt". I'm > looking to be able to access variables that describe the installation > location in order to set dynamic registry values. > > Many thanks, > > Steve. > > "Kevin Spencer" wrote: > >> Hi Steve, >> >> I you're using Visual Studio, in the Window for the Setup Registry, after >> creating the Key, right-click it and select "New " (whatever type of >> value). >> >> -- >> HTH, >> >> Kevin Spencer >> Microsoft MVP >> Software Composer >> http://unclechutney.blogspot.com >> >> In case of Minimalism, break Philip Glass. >> >> "Steve Barker" <stevebarker@nospam.nospam> wrote in message >> news:43301961-07A1-4BE2-B92A-F51C4C5655C2@microsoft.com... >> > Hi guys, >> > >> > Apologies if this is posted in the wrong please; if so, please let me >> > know >> > and I'll re-post. (Apologies also for duplicating a post I made >> > previously; >> > I've had some problems with my passport account associations!) >> > >> > I've just written an installer using Visual Studio 2005, and as part of >> > the >> > install, I want to create some registry keys. I want the registry keys >> > to >> > contain, amongst other things, the directory that the product was >> > installed >> > into. Creating registry keys using the installer is very easy, but I'm >> > not >> > sure how to include installation specific information into these keys. >> > Is >> > there some kind of variable I can use to get the values I require? I >> > will >> > also need to do some string manipulation on these values. For instance, >> > if >> > the installation location is "C:\Program Files\Test", I might need to >> > write >> > "C:\Program Files\Test\MyFile.txt" to the registry. >> > >> > Any help would be gratefully received! >> > >> > Many thanks, >> > >> > Steve. >> > >> >> >> |
|
|
|
#4 |
|
Guest
Posts: n/a
|
Thanks for Kevin's input.
Hi Steve, I think what you want is doable through the VS 2005 setup project. Here are some approaches you can consider: 1. There are plenty of built-in and context related propeties in windows setup/installer sdk. And such properties can also be used in VS setup project(since the setup project provide a sub set of what windows installer sdk provides). #Property Reference http://msdn2.microsoft.com/en-us/library/aa370905.aspx And for the installation folder(main folder) the user choose at runtime, there is a corresponding property named "TARGETDIR". So you can get the main install folder of the installing program in your setup project. #TARGETDIR Property http://msdn2.microsoft.com/en-us/library/aa372064.aspx You can directly use this property in the VS setup project's registry editor(pass the property name into the certain registry item's value) e.g. value: [TARGETDIR]\ #Properties for the Registry Editor http://msdn2.microsoft.com/en-gb/library/bbxyfa24(VS.80).aspx 2. The above one may be quite limited when you want to add more values derived from the built-in properties(in windows installer). For example, you may want to concatenate the propety with other values. Then, you can consider creating a custom Action to do the work. You can pass those context or built-in properties in to your custom action and use those properties in your own code. Here are some good reference introducing using custom action and pass data into it: #Walkthrough: Using a Custom Action to Display a Message at Installation http://msdn2.microsoft.com/en-us/library/9cdb5eda(VS.80).aspx #Visual Studio Setup - projects and custom actions http://www.simple-talk.com/dotnet/v...-setup---projec ts-and-custom-actions/ Please let me know if you have anything unclear. If you feel necessry I can send you a very simple setup project demo on this. Sincerely, Steven Cheng Microsoft MSDN Online Support Lead ================================================== Get notification to my posts through email? Please refer to http://msdn.microsoft.com/subscript...ault.aspx#notif ications. Note: The MSDN Managed Newsgroup support offering is for non-urgent issues where an initial response from the community or a Microsoft Support Engineer within 1 business day is acceptable. Please note that each follow up response may take approximately 2 business days as the support professional working with you may need further investigation to reach the most efficient resolution. The offering is not appropriate for situations that require urgent, real-time or phone-based interactions or complex project analysis and dump analysis issues. Issues of this nature are best handled working with a dedicated Microsoft Support Engineer by contacting Microsoft Customer Support Services (CSS) at http://msdn.microsoft.com/subscript...rt/default.aspx. ================================================== This posting is provided "AS IS" with no warranties, and confers no rights. |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

