Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
0
Reply
InstallerSetup.cs pass installation parameters in from1.cs
Pax Obi
Jan 19 2018 12:50 AM
148
Reply
I have properly overwrite commit in InstallerSetup.cs I do not wish to write the user entered value to app.config but rather I want to pass the string Context.Parameters["TESTPARAMETER"]; to another class in form1.cs on load function. I tried string test = InstallerSetup.Context.Parameters["TESTPARAMETER"]; but getting InstallerSetup.Context is null . Please Help.
InstallerSetup.cs
public
override
void
Commit(IDictionary savedState)
{
base
.Commit(savedState);
try
{
SQLSERVERNAME = Context.Parameters[
"SQLSERVERNAME"
];
HMSTENANTDB = Context.Parameters[
"HMSTENANTDB"
];
SQLLOGIN = Context.Parameters[
"SQLLOGIN"
];
SQLPASSWORD = Context.Parameters[
"SQLPASSWORD"
];
}
catch
(Exception e)
{
MessageBox.Show(
"Failed to update the application configuration file : "
+ e.Message);
base
.Rollback(savedState);
}
}
from1.cs
InstallerSetup InsSetup =
new
InstallerSetup();
string
Vsqlserver = InsSetup.Installers.Count.ToString();
string
Vtenant =
""
;
if
(InsSetup.Context !=
null
)
{
Vtenant = InsSetup.Context.Parameters[
"HMSTENANTDB"
];
}
else
{
Vtenant =
"context is null"
;
}
Attachment:
InstallerSetup.rar
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
0
)
Next Recommended Forum
How to start your own business
getting error on setup??