Groups | Blog | Home
all groups > dotnet setup > october 2004 >

dotnet setup : Run a script whether the app gets installed or not.


hyper_x_43 NO[at]SPAM yahoo.com
10/20/2004 3:01:12 PM
Hey guys,

I've written this MSI installer after a great deal of time (about a
week or so) to suit the needs of my client and 'I'm almost there'.

The users (about 150 of them) have only one shortcut on their
desktops. When clicked, it fetches the MSI from the shared drive F:\

When the versions are different the installer installs the package and
runs the app from the local drive by the following code...

protected override void OnAfterInstall(IDictionary savedState)
{
System.Diagnostics.Process.Start(psi);
}

and everything is fine.

THE PROBLEM:
------------
When the application finds that the VERSIONS ARE SAME, it just QUITS
WITHOUT executing any of the following overridden methods that come
with the installer class.

protected override void OnAfterInstall(IDictionary savedState)
protected override void OnBeforeInstall(IDictionary savedState)
public override void Commit(IDictionary savedState)
public override void Install(IDictionary stateSaver)
protected override void OnAfterRollback(IDictionary savedState)
protected override void OnBeforeRollback(IDictionary savedState)
public override void Rollback(IDictionary savedState)
protected override void OnCommitting(IDictionary savedState)
protected override void OnCommitted(IDictionary savedState)
protected override void OnAfterUninstall(IDictionary savedState)
protected override void OnBeforeUninstall(IDictionary savedState)
public override void Uninstall(IDictionary savedState)
public override object InitializeLifetimeService()


All I need to be able to do is to run that same Process.Start(blah)
when the installer DETECTS THE SAME version, but none of the above
overridden methods get executed... I'm kind of lost in this.

Any help from anyone is appreciated.

Regards,

Phil Wilson
10/22/2004 11:44:03 AM
The explanation is that Windows Installer will not install the same product
again if it appears to be identical, and since the version (and probably
ProductCode too) is identical, you appear to have the same product already
installed. It probably goes into repair mode and finds nothing broken. If
you've really got a new or different product, you have to change something
so that Windows knows you're not just trying to install the same thing
twice. I'd guess that if you want clients to have multiple versions of this
on their systems you should change the ProductCode every time you build a
new one.
--
Phil Wilson
[Microsoft MVP-Windows Installer]
Definitive Guide to Windows Installer
http://apress.com/book/bookDisplay.html?bID=280

[quoted text, click to view]

Hyper X
10/25/2004 10:02:55 AM
Phil,

The idea is run the app no matter what. i.e., if there is a new version
available on the server, get it, install it, and run the application.
If there is no new version available, just run the application.

When the product version is different, the application gets installed,
Process.Start("blah") starts the application. THE PROBLEM is when there
is NO product version available, I'm not able to get the application
started.

I tried to run the overridden event handler methods (to do
Process.Start("blah") when the product versions are SAME, but none of
the events that I mentioned get fired.

Please help me with this. I've been struggling for quite a while now.

I don't believe in third party tools.

Thanks

HyperX.

*** Sent via Developersdex http://www.developersdex.com ***
Phil Wilson
10/28/2004 10:03:12 AM
I can't figure out what you're describing. It looks like you have a setup
package that installs a shortcut, and when the user has installed this
package and uses the shortcut, the program goes to a share to see if there
is a newer version of the product available and if so it installs it. What
I don't understand is what makes you think your custom action events will
get called when the versions are the same and nothing new is being
installed. Custom actions get called at install time, but you seem to
believe that they'll be called every time the user goes through that
shortcut. You seem to be relying on Process.Start() out of an Installer
class that in fact does not get called unless you are actually installing
something.
--
Phil Wilson
[Microsoft MVP-Windows Installer]
Definitive Guide to Windows Installer
http://apress.com/book/bookDisplay.html?bID=280

[quoted text, click to view]

HyperX
10/28/2004 11:53:41 AM
Thats correct. I'm relying on one of the installer class methods to do
Process.Start().

Can I get the installer to expose any of its methods which may be like,

public void VersionCheckerNewVersionNOTAvailable()?

In summary, I want the shortcut on the user's desktop to do the
following.

1. Check if there is a new version available on the shared location
(which is done by the installer class).

2. If there is a new version available, install it(done by installer
class), else go to step 3.

3. Launch the application (by the batch file).


Phil, I also want to know if the way I'm doing is the most decent way of
doing it.

Rgds,

HyperX.

*** Sent via Developersdex http://www.developersdex.com ***
Mike Blake-Knox
10/30/2004 4:36:14 PM
[quoted text, click to view]
How about pointing the shortcut to the batch file, having the batch file
decide whether or not a newer version is available, doing the install
(if appropriate) and then starting the application?

You could also put this logic into a C# or VB program.

Mike
HyperX
11/1/2004 11:21:55 AM
Mike,

How can I figure it out via batch file if there is a new version of MSI
available or not?

Or, if it has to be done in the installer class, I'm lost as to which
overridden method from the installer class that I should be using.

Any help is appreciated.

Thanks,

HyperX


*** Sent via Developersdex http://www.developersdex.com ***
AddThis Social Bookmark Button