473,221 Members | 1,919 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,221 software developers and data experts.

Post-install operations from the MSI

I've yet to find a decently worded and exampled article outlining how one can
perform more complex operations during MSI installation.

Specifically, I'm looking to copy the source MSI to the installed directory
(in essence saving a backup of it) after the installation has completed.

I found a couple articles that use an "installhelper.cs" file w/in the main
output project, but I've implemeted this in VS.NET 2k5 / .NET 2.0 with no
success.

Please let me know if any good resources for performing operations such as
these during installation w/ an MSI. Thanks!
May 10 '06 #1
8 4533
Brandon,

If you find out any good sources, let me know. The Windows Installer under
VS 2005 seems to be an area that no one touches or most developers seem to
have the luxury of parsing this task out to someone else. I'm amazed at the
lack of samples and documentation I've found on using Deployment Projects.
Even the MSDN shows very little useful sample information -- they just spew
out information with no context reference.

As for your issue, have you tried adding a ProjectInstaller component to the
project your distributing? Or you can create a DLL or EXE from .NET and
reference that via Custom Actions and be sure to set the InstallClass =
True.

Also, it seems that because of "Rollback" functionality, get anything done
PRIOR to installation is close to impossible. I'm still struggling on
removing an older version of a Windows Service (I even know the ProductCode
aka ComponentID) I wrote with a newer version that has a different product
code. I'm stuck in a recursive hell -- I can't uninstall my old service
first because of rollback issues MSI enforces, I can't install my new
service because it will conflict with the existing service so I can't get to
a point where I can uninstall the old service. This is some seriously
sadistic limitation in the MSI approach. The funny (or not so funny) is
that products like InstallShield are no better and don't resolve this issues
either -- very frustrating.

I'd be greatful if you posted a link if you get any good info.

Thanks, Rob.
"Brandon @ KMG" <Brandon @ KM*@discussions.microsoft.com> wrote in message
news:2F**********************************@microsof t.com...
I've yet to find a decently worded and exampled article outlining how one
can
perform more complex operations during MSI installation.

Specifically, I'm looking to copy the source MSI to the installed
directory
(in essence saving a backup of it) after the installation has completed.

I found a couple articles that use an "installhelper.cs" file w/in the
main
output project, but I've implemeted this in VS.NET 2k5 / .NET 2.0 with no
success.

Please let me know if any good resources for performing operations such as
these during installation w/ an MSI. Thanks!

May 10 '06 #2
I'll definitely do that. I, too, am amazed at the lack of documentation and
samples regarding this.

I haven't done the ProjectInstaller as this isn't a windows service, just a
standard executable I'm bundling up into an MSI with its references. I may,
however, try and get an installer into the project. I know w/ a windows
service you just right click the "blank" background in the component designer
to get the Project Installer option and then it runs when you use the
InstallUtil to install it. However, if a user downloads my MSI and runs the
installation, that's not going to utilize this functionality, or will it?

Would be nice to get an MS rep in here to get the ball rolling on some
actually useful docs regarding the setup and deployment projects. Maybe our
posts here can get that done at the very least.
--
KMG Software, Inc.
Thinking Beyond, Above, and Before
http://www.kmgsoftware.com
"Rob R. Ainscough" wrote:
Brandon,

If you find out any good sources, let me know. The Windows Installer under
VS 2005 seems to be an area that no one touches or most developers seem to
have the luxury of parsing this task out to someone else. I'm amazed at the
lack of samples and documentation I've found on using Deployment Projects.
Even the MSDN shows very little useful sample information -- they just spew
out information with no context reference.

As for your issue, have you tried adding a ProjectInstaller component to the
project your distributing? Or you can create a DLL or EXE from .NET and
reference that via Custom Actions and be sure to set the InstallClass =
True.

Also, it seems that because of "Rollback" functionality, get anything done
PRIOR to installation is close to impossible. I'm still struggling on
removing an older version of a Windows Service (I even know the ProductCode
aka ComponentID) I wrote with a newer version that has a different product
code. I'm stuck in a recursive hell -- I can't uninstall my old service
first because of rollback issues MSI enforces, I can't install my new
service because it will conflict with the existing service so I can't get to
a point where I can uninstall the old service. This is some seriously
sadistic limitation in the MSI approach. The funny (or not so funny) is
that products like InstallShield are no better and don't resolve this issues
either -- very frustrating.

I'd be greatful if you posted a link if you get any good info.

Thanks, Rob.
"Brandon @ KMG" <Brandon @ KM*@discussions.microsoft.com> wrote in message
news:2F**********************************@microsof t.com...
I've yet to find a decently worded and exampled article outlining how one
can
perform more complex operations during MSI installation.

Specifically, I'm looking to copy the source MSI to the installed
directory
(in essence saving a backup of it) after the installation has completed.

I found a couple articles that use an "installhelper.cs" file w/in the
main
output project, but I've implemeted this in VS.NET 2k5 / .NET 2.0 with no
success.

Please let me know if any good resources for performing operations such as
these during installation w/ an MSI. Thanks!


May 10 '06 #3
After my previous post I found the "Installer Class" item in the project area
and threw one of these in. Using the example I found at
http://www.codeproject.com/dotnet/Se...Deployment.asp
I implemented a simple test of overriding the Install() method (to pop up a
message box) but it didn't work. Now, messageboxes may not be allowed which
could be my problem, but nonetheless my main constraint here is to try and
get the location of the MSI that is running so that I can copy it to the
application's installation directory for the backup. I may be getting closer
but would still appreciate some insight.

--
KMG Software, Inc.
Thinking Beyond, Above, and Before
http://www.kmgsoftware.com
"Rob R. Ainscough" wrote:
Brandon,

If you find out any good sources, let me know. The Windows Installer under
VS 2005 seems to be an area that no one touches or most developers seem to
have the luxury of parsing this task out to someone else. I'm amazed at the
lack of samples and documentation I've found on using Deployment Projects.
Even the MSDN shows very little useful sample information -- they just spew
out information with no context reference.

As for your issue, have you tried adding a ProjectInstaller component to the
project your distributing? Or you can create a DLL or EXE from .NET and
reference that via Custom Actions and be sure to set the InstallClass =
True.

Also, it seems that because of "Rollback" functionality, get anything done
PRIOR to installation is close to impossible. I'm still struggling on
removing an older version of a Windows Service (I even know the ProductCode
aka ComponentID) I wrote with a newer version that has a different product
code. I'm stuck in a recursive hell -- I can't uninstall my old service
first because of rollback issues MSI enforces, I can't install my new
service because it will conflict with the existing service so I can't get to
a point where I can uninstall the old service. This is some seriously
sadistic limitation in the MSI approach. The funny (or not so funny) is
that products like InstallShield are no better and don't resolve this issues
either -- very frustrating.

I'd be greatful if you posted a link if you get any good info.

Thanks, Rob.
"Brandon @ KMG" <Brandon @ KM*@discussions.microsoft.com> wrote in message
news:2F**********************************@microsof t.com...
I've yet to find a decently worded and exampled article outlining how one
can
perform more complex operations during MSI installation.

Specifically, I'm looking to copy the source MSI to the installed
directory
(in essence saving a backup of it) after the installation has completed.

I found a couple articles that use an "installhelper.cs" file w/in the
main
output project, but I've implemeted this in VS.NET 2k5 / .NET 2.0 with no
success.

Please let me know if any good resources for performing operations such as
these during installation w/ an MSI. Thanks!


May 10 '06 #4
I put the installerClass into my program, set the install custom action to
the output from my project and that it was an InstallerClass, and put the
following code into an InstallHelper.cs class w/in my project:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration.Install;

namespace KMG.BusRunner
{
[RunInstaller(true)]
public partial class InstallHelper : Installer
{
public InstallHelper()
{
InitializeComponent();
}

public override void Install(System.Collections.IDictionary stateSaver)
{
base.Install(stateSaver);

System.Diagnostics.EventLog.WriteEntry("MyProgram" ,
System.Reflection.Assembly.GetExecutingAssembly(). Location);
System.IO.File.Copy(System.Reflection.Assembly.Get ExecutingAssembly().Location,

System.Environment.GetFolderPath(Environment.Speci alFolder.DesktopDirectory));
}
}
}

It does not write anything to the event log, and doesn't do a copy to my
desktop either.
--
KMG Software, Inc.
Thinking Beyond, Above, and Before
http://www.kmgsoftware.com
"Brandon @ KMG" wrote:
I've yet to find a decently worded and exampled article outlining how one can
perform more complex operations during MSI installation.

Specifically, I'm looking to copy the source MSI to the installed directory
(in essence saving a backup of it) after the installation has completed.

I found a couple articles that use an "installhelper.cs" file w/in the main
output project, but I've implemeted this in VS.NET 2k5 / .NET 2.0 with no
success.

Please let me know if any good resources for performing operations such as
these during installation w/ an MSI. Thanks!

May 10 '06 #5
What are you using to invoke the Install? (for testing you should be able
to right click the Deployment Project and select Install).

couple of suggestions:
1. You should be able to add a ProjectInstaller component to your app?
2. Use the events from the ProjectInstaller (i.e. _BeforeInstall,
_Committing, _AfterInstall)
3. Add eventlog code to the _Committing to see if it is being triggered

My reference is VB.NET so please excuse me if I use any different terms.

"Brandon @ KMG" <Br********@discussions.microsoft.com> wrote in message
news:FE**********************************@microsof t.com...
I put the installerClass into my program, set the install custom action to
the output from my project and that it was an InstallerClass, and put the
following code into an InstallHelper.cs class w/in my project:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration.Install;

namespace KMG.BusRunner
{
[RunInstaller(true)]
public partial class InstallHelper : Installer
{
public InstallHelper()
{
InitializeComponent();
}

public override void Install(System.Collections.IDictionary stateSaver)
{
base.Install(stateSaver);

System.Diagnostics.EventLog.WriteEntry("MyProgram" ,
System.Reflection.Assembly.GetExecutingAssembly(). Location);
System.IO.File.Copy(System.Reflection.Assembly.Get ExecutingAssembly().Location,

System.Environment.GetFolderPath(Environment.Speci alFolder.DesktopDirectory));
}
}
}

It does not write anything to the event log, and doesn't do a copy to my
desktop either.
--
KMG Software, Inc.
Thinking Beyond, Above, and Before
http://www.kmgsoftware.com
"Brandon @ KMG" wrote:
I've yet to find a decently worded and exampled article outlining how one
can
perform more complex operations during MSI installation.

Specifically, I'm looking to copy the source MSI to the installed
directory
(in essence saving a backup of it) after the installation has completed.

I found a couple articles that use an "installhelper.cs" file w/in the
main
output project, but I've implemeted this in VS.NET 2k5 / .NET 2.0 with no
success.

Please let me know if any good resources for performing operations such
as
these during installation w/ an MSI. Thanks!

May 10 '06 #6
Yeah I'm right-clicking the deployment project and choosing 'Install'.

Could you tell me what namespace the ProjectInstaller is in? I can't find it
anywhere in the C# side of things. The only thing I saw was the "Installer
Class" item that I could choose when I did "Add new Item..." on the project.
Which is what I did, and what was showcased in the "tutorial" that I pasted
earlier, but it's not working.
--
He who dies with the most toys wins.
"Rob R. Ainscough" wrote:
What are you using to invoke the Install? (for testing you should be able
to right click the Deployment Project and select Install).

couple of suggestions:
1. You should be able to add a ProjectInstaller component to your app?
2. Use the events from the ProjectInstaller (i.e. _BeforeInstall,
_Committing, _AfterInstall)
3. Add eventlog code to the _Committing to see if it is being triggered

My reference is VB.NET so please excuse me if I use any different terms.

"Brandon @ KMG" <Br********@discussions.microsoft.com> wrote in message
news:FE**********************************@microsof t.com...
I put the installerClass into my program, set the install custom action to
the output from my project and that it was an InstallerClass, and put the
following code into an InstallHelper.cs class w/in my project:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration.Install;

namespace KMG.BusRunner
{
[RunInstaller(true)]
public partial class InstallHelper : Installer
{
public InstallHelper()
{
InitializeComponent();
}

public override void Install(System.Collections.IDictionary stateSaver)
{
base.Install(stateSaver);

System.Diagnostics.EventLog.WriteEntry("MyProgram" ,
System.Reflection.Assembly.GetExecutingAssembly(). Location);
System.IO.File.Copy(System.Reflection.Assembly.Get ExecutingAssembly().Location,

System.Environment.GetFolderPath(Environment.Speci alFolder.DesktopDirectory));
}
}
}

It does not write anything to the event log, and doesn't do a copy to my
desktop either.
--
KMG Software, Inc.
Thinking Beyond, Above, and Before
http://www.kmgsoftware.com
"Brandon @ KMG" wrote:
I've yet to find a decently worded and exampled article outlining how one
can
perform more complex operations during MSI installation.

Specifically, I'm looking to copy the source MSI to the installed
directory
(in essence saving a backup of it) after the installation has completed.

I found a couple articles that use an "installhelper.cs" file w/in the
main
output project, but I've implemeted this in VS.NET 2k5 / .NET 2.0 with no
success.

Please let me know if any good resources for performing operations such
as
these during installation w/ an MSI. Thanks!


May 10 '06 #7
Oops, sorry -- you do have the Installer class -- Inherits
System.Configuration.Install.Installer -- I think the C# translation got me
as your events are named different.

"Brandon" <Br*****@discussions.microsoft.com> wrote in message
news:13**********************************@microsof t.com...
Yeah I'm right-clicking the deployment project and choosing 'Install'.

Could you tell me what namespace the ProjectInstaller is in? I can't find
it
anywhere in the C# side of things. The only thing I saw was the "Installer
Class" item that I could choose when I did "Add new Item..." on the
project.
Which is what I did, and what was showcased in the "tutorial" that I
pasted
earlier, but it's not working.
--
He who dies with the most toys wins.
"Rob R. Ainscough" wrote:
What are you using to invoke the Install? (for testing you should be
able
to right click the Deployment Project and select Install).

couple of suggestions:
1. You should be able to add a ProjectInstaller component to your app?
2. Use the events from the ProjectInstaller (i.e. _BeforeInstall,
_Committing, _AfterInstall)
3. Add eventlog code to the _Committing to see if it is being triggered

My reference is VB.NET so please excuse me if I use any different terms.

"Brandon @ KMG" <Br********@discussions.microsoft.com> wrote in message
news:FE**********************************@microsof t.com...
>I put the installerClass into my program, set the install custom action
>to
> the output from my project and that it was an InstallerClass, and put
> the
> following code into an InstallHelper.cs class w/in my project:
>
> using System;
> using System.Collections.Generic;
> using System.ComponentModel;
> using System.Configuration.Install;
>
> namespace KMG.BusRunner
> {
> [RunInstaller(true)]
> public partial class InstallHelper : Installer
> {
> public InstallHelper()
> {
> InitializeComponent();
> }
>
> public override void Install(System.Collections.IDictionary
> stateSaver)
> {
> base.Install(stateSaver);
>
> System.Diagnostics.EventLog.WriteEntry("MyProgram" ,
> System.Reflection.Assembly.GetExecutingAssembly(). Location);
>
>
> System.IO.File.Copy(System.Reflection.Assembly.Get ExecutingAssembly().Location,
>
> System.Environment.GetFolderPath(Environment.Speci alFolder.DesktopDirectory));
> }
> }
> }
>
> It does not write anything to the event log, and doesn't do a copy to
> my
> desktop either.
> --
> KMG Software, Inc.
> Thinking Beyond, Above, and Before
> http://www.kmgsoftware.com
>
>
> "Brandon @ KMG" wrote:
>
>> I've yet to find a decently worded and exampled article outlining how
>> one
>> can
>> perform more complex operations during MSI installation.
>>
>> Specifically, I'm looking to copy the source MSI to the installed
>> directory
>> (in essence saving a backup of it) after the installation has
>> completed.
>>
>> I found a couple articles that use an "installhelper.cs" file w/in the
>> main
>> output project, but I've implemeted this in VS.NET 2k5 / .NET 2.0 with
>> no
>> success.
>>
>> Please let me know if any good resources for performing operations
>> such
>> as
>> these during installation w/ an MSI. Thanks!


May 10 '06 #8
Still another buggy situation with the S&D projects is that when you set a
custom action to execute, it "halts" the installer until that action is
completed. Thereby I can't find a way to automatically run my program after
the installation is completed. Has anybody successfully done this??
--
KMG Software, Inc.
Thinking Beyond, Above, and Before
http://www.kmgsoftware.com
"Brandon @ KMG" wrote:
I've yet to find a decently worded and exampled article outlining how one can
perform more complex operations during MSI installation.

Specifically, I'm looking to copy the source MSI to the installed directory
(in essence saving a backup of it) after the installation has completed.

I found a couple articles that use an "installhelper.cs" file w/in the main
output project, but I've implemeted this in VS.NET 2k5 / .NET 2.0 with no
success.

Please let me know if any good resources for performing operations such as
these during installation w/ an MSI. Thanks!

May 11 '06 #9

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

Similar topics

15
by: Thomas Scheiderich | last post by:
I am trying to understand Session variables and ran into a question on how they work with data that is passed. I have an HTM file that calls an ASP file and sends the name either by GET or POST....
1
by: khawar | last post by:
my application is in asp.net using C# hi guys having a complicated problem i am using payflowlink to process CC payments I have to send a httppost to their servers. The problem is how do i do a...
2
by: Matt | last post by:
When we submit the form data to another page, we usually do the following: <form action="display.aspx" method="post"> will submit the form data and open display.asp in the current browser ...
1
by: Manuel | last post by:
I have to log into a website and retrieve some information. The problem is that the post isn't "normal". I'm used to passing post values in the form of: Variable1=Value1&Variable2=Value2 etc. I...
10
by: glenn | last post by:
I am use to programming in php and the way session and post vars are past from fields on one page through to the post page automatically where I can get to their values easily to write to a...
24
by: moriman | last post by:
Hi, The script below *used* to work. I have only just set up a server, PHP etc again on my Win98 system and now it doesn't? On first loading this page, you would have $p = and the button...
9
by: c676228 | last post by:
Hi, I am new to this discussion forum. I started to post questions on this forum since this Jan. and got many good responses and I am very appreciated to those who are willing to help with their...
3
by: JansenH | last post by:
We have implemented a 'HTTP Post' client in C# that posts Xml documents to a webserver. This is working fine if the post rate is one post for every 20 seconds. But if the post rate is increased to...
10
by: Peter Michaux | last post by:
Hi, All Ajax libraries I've read use encodeURIComponent() on the name- value pairs extracted from forms before POST ing the result to the server with and xmlhttprequest. I can understand why...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

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.