.net/msi project questions

  • Thread starter Thread starter TDOR
  • Start date Start date
T

TDOR

Using VS2003 I have created a solution containing 2
c# projects and one setup project. One c# project is
a nt service and a project installer for the service.
The second c# project is a form and an installer to
show the form during the install process. Primary
output from both these projects has been added to the
setup project and to custom actions (install/commit/rollback/
uninstall).

1) How do I abort/rollback the installation if the data the
user provides in the form is not correct? From the
installer that shows the form I have tried:
this.parent.rollback()
but it dosent seem to rollback what the other installer
has installed.

2) The form that I use to collect data during setup is also
made available from the users programs menu. The form shows up
as "someform.exe" in the menu. How do I give the entry a
name other than the filename? (I added it by rightclicking
the setupproject then selecting view->file system and adding
the form to the user's program menu node).
 
1) Is to throw an InstallException from the installer class method being
called. However it's not clear to me what you're doing - it looks like
you're running a program as a custom action, so if the custom action is set
up to abort if it fails, try returning a non-zero exit code from the
program.

2) Seems to be a Windows Forms question.

What you're doing is not recommended because runnning UI from the execute
sequence is "a bad thing. You should insert a dialog into the UI sequence
and collect your data there into properties that you use in custom actions
etc later on.
 
How can i return a code from an installer?

This is how the installer looks thats opens a form during install:

[RunInstaller(true)]
public class InitServerInstaller : Installer
{
public InitServerInstaller() :base()
{
}

public override void Install(IDictionary savedState)
{
base.Install(savedState);

InitServerForm form = new InitServerForm();
if (form.ShowDialog() == DialogResult.OK) {


}
else {

}
}

}



Phil Wilson said:
1) Is to throw an InstallException from the installer class method being
called. However it's not clear to me what you're doing - it looks like
you're running a program as a custom action, so if the custom action is set
up to abort if it fails, try returning a non-zero exit code from the
program.

2) Seems to be a Windows Forms question.

What you're doing is not recommended because runnning UI from the execute
sequence is "a bad thing. You should insert a dialog into the UI sequence
and collect your data there into properties that you use in custom actions
etc later on.
--
Phil Wilson
[MVP Windows Installer]
Definitive Guide to Windows Installer
http://apress.com/book/bookDisplay.html?bID=280

TDOR said:
Using VS2003 I have created a solution containing 2
c# projects and one setup project. One c# project is
a nt service and a project installer for the service.
The second c# project is a form and an installer to
show the form during the install process. Primary
output from both these projects has been added to the
setup project and to custom actions (install/commit/rollback/
uninstall).

1) How do I abort/rollback the installation if the data the
user provides in the form is not correct? From the
installer that shows the form I have tried:
this.parent.rollback()
but it dosent seem to rollback what the other installer
has installed.

2) The form that I use to collect data during setup is also
made available from the users programs menu. The form shows up
as "someform.exe" in the menu. How do I give the entry a
name other than the filename? (I added it by rightclicking
the setupproject then selecting view->file system and adding
the form to the user's program menu node).
 
You don't return a code from an Installer method, it's a void method, and
you throw an InstallException if you want to abort the installation. What do
you want to do with the "code"? I don't understand the big picture here -
you're talking about forms and data, but I can't tell what you're actually
trying to accomplish with the forms program and the data.
--
Phil Wilson
[MVP Windows Installer]
TDOR said:
How can i return a code from an installer?

This is how the installer looks thats opens a form during install:

[RunInstaller(true)]
public class InitServerInstaller : Installer
{
public InitServerInstaller() :base()
{
}

public override void Install(IDictionary savedState)
{
base.Install(savedState);

InitServerForm form = new InitServerForm();
if (form.ShowDialog() == DialogResult.OK) {


}
else {

}
}

}



"Phil Wilson" <[email protected]> wrote in message
1) Is to throw an InstallException from the installer class method being
called. However it's not clear to me what you're doing - it looks like
you're running a program as a custom action, so if the custom action is set
up to abort if it fails, try returning a non-zero exit code from the
program.

2) Seems to be a Windows Forms question.

What you're doing is not recommended because runnning UI from the execute
sequence is "a bad thing. You should insert a dialog into the UI sequence
and collect your data there into properties that you use in custom actions
etc later on.
--
Phil Wilson
[MVP Windows Installer]
Definitive Guide to Windows Installer
http://apress.com/book/bookDisplay.html?bID=280

TDOR said:
Using VS2003 I have created a solution containing 2
c# projects and one setup project. One c# project is
a nt service and a project installer for the service.
The second c# project is a form and an installer to
show the form during the install process. Primary
output from both these projects has been added to the
setup project and to custom actions (install/commit/rollback/
uninstall).

1) How do I abort/rollback the installation if the data the
user provides in the form is not correct? From the
installer that shows the form I have tried:
this.parent.rollback()
but it dosent seem to rollback what the other installer
has installed.

2) The form that I use to collect data during setup is also
made available from the users programs menu. The form shows up
as "someform.exe" in the menu. How do I give the entry a
name other than the filename? (I added it by rightclicking
the setupproject then selecting view->file system and adding
the form to the user's program menu node).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top