473,414 Members | 1,944 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,414 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 4544
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.