By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,640 Members | 1,331 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,640 IT Pros & Developers. It's quick & easy.

Deployment (Custom Actions)

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.