Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Setup / January 2005

Tip: Looking for answers? Try searching our database.

OnAfterInstall -- wrong version called

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
GoogleNewsReaderMan - 27 Jan 2005 21:00 GMT
When performing an installation on a machine that has a previous
version of my application, the PREVIOUS version's OnAfterInstall method
is called, not the new version's!

How can I solve this problem?
Any help appreciated.

Thanks in advance.
GoogleNewsReaderMan - 27 Jan 2005 21:57 GMT
If I have 'RemovePreviousVersions' property set to true for my
installer, then all the event methods I override in my installer are
called on the OLD version--the one that is being UNinstalled.

Only the uninstall related methods should be called on the old version,
then the new version's methods should be called.

Anyone else experience this? Anyone have a workaround? This is a bug,
right? Or is it a feature that I just don't understand?
Thanks in advance for any help.
Phil Wilson - 28 Jan 2005 05:04 GMT
I think this has been reported to MS as a bug. If this is the issue I think
it is, it's related to calling custom actions in an assembly that has the
same name in the old setup as in the new one that's replacing it. The
uninstall of the old product calls an uninstall custom action and loads the
assembly, then the install of the new product seems to call that same old
assembly because this is all in one AppDomain, and the assembly is already
loaded into it. I think that you will need to change the name of the
assembly containing the custom actions in the new version of the product.
Signature

Phil Wilson
[Microsoft MVP-Windows Installer]
Definitive Guide to Windows Installer
http://apress.com/book/bookDisplay.html?bID=280

> When performing an installation on a machine that has a previous
> version of my application, the PREVIOUS version's OnAfterInstall method
[quoted text clipped - 4 lines]
>
> Thanks in advance.
GoogleNewsReaderMan - 28 Jan 2005 14:56 GMT
Thanks for the info. I appreciate it.

I am amazed, though. I can understand maybe in v. 1.0 it might be like
this. But how did this bug make it all the way to 1.1 SP1?

Is there any better work-around for this? Changing the name of the
assembly is overkill to say the least. Is there a programatic way to
deal with this?

Thanks again.
Phil Wilson - 28 Jan 2005 15:33 GMT
No, I don't believe so. There's been some discussion about detours but there
doesn't seem to be one. Internally, VS builds an MSI that calls a shim DLL
that then loads your assembly, apparently using Assembly.LoadFrom, not
Assembly.Load. The result is that you can't change something like the strong
name or assemblyversion to get the new version because the LoadFrom is just
a path with no other assembly definition. It's not a framework issue. IMO
it's an issue with the shim DLL that sits between MSI and your custom action
code. If it used Assembly.Load with assembly specs like strong name, you
could detour it; if it used separate AppDomains for the install and
uninstall steps, that might work too, but that's just my speculation.
Signature

Phil Wilson
[Microsoft MVP-Windows Installer]
Definitive Guide to Windows Installer
http://apress.com/book/bookDisplay.html?bID=280

> Thanks for the info. I appreciate it.
>
[quoted text clipped - 6 lines]
>
> Thanks again.
GoogleNewsReaderMan - 28 Jan 2005 18:33 GMT
Here is a "work-around" so to speak.

If you want to remove previous versions on a new install, then if you
have any custom actions for uninstall, then the problem described in
this thread arrises.

If you use 2 separate installers, in 2 separate assemblies -- one
installer used for uninstalling actions, and one installer for
installing actions, then the proper versions of assemblies will be
used.

It's crazy, but it is the best solution I can come up with.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.