473,320 Members | 1,699 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Deployment (Custom Actions)

Hello,
I'm trying to get the installation folder that the user selects from my
setup program so I can write the value to the registry. I've written a
custom Installer that inherits from System.Configuration.Install.Installer
and overridden the Install and Uninstall methods. I'm trying to get the
install folder by using the MyBase.Context.Parameters("INSTALLDIR") (also
tried "TARGETDIR") and I get nothing back but TargetDir so that's what gets
written into the registry. Does anybody know a reliable way to get the
Install folder from the Context object? Or, am I going about this all wrong?

Code:
public override Sub Install(stateSaver As IDictionary)
RegistryKey rKey = Registry.LocalMachine.OpenSubKey(SOFTWARE, True)
RegistryKey newKey = rKey.CreateSubKey(SUBKEY)
newKey.SetValue(IMAPPATH, MyBase.Context.Parameters("TARGETDIR"))
stateSaver.Add(IMAPPATH, MyBase.Context.Parameters("TARGETDIR"))
newKey.Close()
rKey.Close()
End Sub

I appreciate any help on this as I'm stumped.
Steve
Nov 21 '05 #1
2 2456
Hi,

Maybe try me instead of mybase.

Ken
--------------
"Steve Long" <St**********@NoSpam.com> wrote in message
news:e$**************@tk2msftngp13.phx.gbl...
Hello,
I'm trying to get the installation folder that the user selects from my
setup program so I can write the value to the registry. I've written a
custom Installer that inherits from System.Configuration.Install.Installer
and overridden the Install and Uninstall methods. I'm trying to get the
install folder by using the MyBase.Context.Parameters("INSTALLDIR") (also
tried "TARGETDIR") and I get nothing back but TargetDir so that's what gets
written into the registry. Does anybody know a reliable way to get the
Install folder from the Context object? Or, am I going about this all wrong?

Code:
public override Sub Install(stateSaver As IDictionary)
RegistryKey rKey = Registry.LocalMachine.OpenSubKey(SOFTWARE, True)
RegistryKey newKey = rKey.CreateSubKey(SUBKEY)
newKey.SetValue(IMAPPATH, MyBase.Context.Parameters("TARGETDIR"))
stateSaver.Add(IMAPPATH, MyBase.Context.Parameters("TARGETDIR"))
newKey.Close()
rKey.Close()
End Sub

I appreciate any help on this as I'm stumped.
Steve

Nov 21 '05 #2
Okay, for this to work, here what has to be done. I didn't have to change
any of the code that is listed below. However, I did have to add the
following line to the CustomActionData property of the Custom Action:

/INSTALLDIR="[TARGETDIR]\"

Including the backslash after TARGETDIR

Steve

"Steve Long" <St**********@NoSpam.com> wrote in message
news:e$**************@tk2msftngp13.phx.gbl...
Hello,
I'm trying to get the installation folder that the user selects from my
setup program so I can write the value to the registry. I've written a
custom Installer that inherits from System.Configuration.Install.Installer
and overridden the Install and Uninstall methods. I'm trying to get the
install folder by using the MyBase.Context.Parameters("INSTALLDIR") (also tried "TARGETDIR") and I get nothing back but TargetDir so that's what gets written into the registry. Does anybody know a reliable way to get the
Install folder from the Context object? Or, am I going about this all wrong?
Code:
public override Sub Install(stateSaver As IDictionary)
RegistryKey rKey = Registry.LocalMachine.OpenSubKey(SOFTWARE, True)
RegistryKey newKey = rKey.CreateSubKey(SUBKEY)
newKey.SetValue(IMAPPATH, MyBase.Context.Parameters("TARGETDIR"))
stateSaver.Add(IMAPPATH, MyBase.Context.Parameters("TARGETDIR"))
newKey.Close()
rKey.Close()
End Sub

I appreciate any help on this as I'm stumped.
Steve

Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Martin | last post by:
I am trying to create a setup project for my C# winforms application. The setup project works perfectly, for the most part. The difficulty I am having is this: I want to run two custom actions...
1
by: Angela | last post by:
I wrote a class that I intended to be a custom action. I added the DLL for the class to the setup project using the CustomActions editor. When I run the installer it completely ignores the custom...
1
by: adeprada | last post by:
Has anyone tried doing this? I am having trouble getting the installer package to run with custom actions written in C#. When I run the installer package it throws a 'BadImagaeFormat' exception...
1
by: Petrucci2000 | last post by:
Hi All, I am looking to create an installation package (MSI ) which will fire off few of my custom .vbs during the install process. How to accomplish this task? TIA PS: I tried to include...
6
by: | last post by:
Hi, I added dotnetfx.exe to a setup project as a custom action to be installed before the main app is installed. I set the Arguments property to /q:a /c:"install /l /q" for a silent install...
0
by: Ron Andersen | last post by:
I have C# custom actions and merge modules created in Visual Studio to install some components of the application I am working on. The merge modules are used with an Install Shield 9 project. ...
0
by: Larry | last post by:
I need to create a custom action application on install. does anyone have any experience on how to configure an application to run on install when creating the 'setup program'? 1.what are the...
1
by: lyl209 | last post by:
Hi, I am trying to create a web setup project for my asp.net 2.0 website and I had some problems. It worked fine until I want to add some custom actions into it. As some of you already knew,...
3
by: KennethLundin | last post by:
Hi, i'm developing a solution in VS9/CSharp. Now I'm constructing a deployment project for my appliation (thick, database driven, winforms, standard, good old type of application). During...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.