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 / Visual Studio.NET / Setup / March 2007

Tip: Looking for answers? Try searching our database.

Uninstall Custom Action not getting called.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
TheClothCat - 12 Feb 2007 12:00 GMT
Hi everyone,

I want to run an exe (Uninst.exe) when my software is uninstalled. I have
added the file to the Application Folder in the File System Editor and added
it as a Custom Action under the Uninstall phase in the Custom Action Editor,
but it does not get executed when my software is uninstalled, either from
within Visual Studio on my development PC or on a different PC when installed
from a CD.

I have put debug code in Uninst.exe so I am sure it is not getting executed.
It is a very simple console app written in C++ for Win32. I got it to work
once on the different PC but it would not do it again.

Stranger still, I changed the Permanent Property of Uninst.exe to be True
and the installer correctly left it in the app's directory. However, after I
changed it back to False it still leaves it there!

It is almost as if Setup uses a cache and the cache is not working properly.
I'm using Visual Studio 2003 with SP1.

I'm baffled. Any ideas would be welcome.

Thank you.
Phil Wilson - 12 Feb 2007 21:02 GMT
Your setup&deployment project has a ProductCode property.  Try the uninstall
like this:

msiexec /x {the product code guid} /l*vx somefile.log

to produce a log of the uninstall. There will be something about whether
there was an attempt to call it. Note that Win32 exes have dependencies that
you might not have installed, like the C runtime support, so it will try to
call it but fail.
Signature

Phil Wilson
[Microsoft MVP Windows Installer]

> Hi everyone,
>
[quoted text clipped - 25 lines]
>
> Thank you.
TheClothCat - 13 Feb 2007 10:31 GMT
Thanks for the reply. Unfortunately your suggestion seems to have had a
distastrous effect. When I ran msiexec as suggested it hung with a DOS window
open called something like MSI40 - I can't remember the number.

Now I cannot install or uninstall my software from within Visual Studio or
outside it, even if I do a full rebuild.

Any suggestions?

> Your setup&deployment project has a ProductCode property.  Try the uninstall
> like this:
[quoted text clipped - 34 lines]
> >
> > Thank you.
TheClothCat - 13 Feb 2007 16:15 GMT
Phil,

Further to my last post, I have now got my setup and deployment project
working again.  That still leaves my original problem though. Is it likely to
be one of the msiexec command line parameters that caused your suggestion to
fail?

> Thanks for the reply. Unfortunately your suggestion seems to have had a
> distastrous effect. When I ran msiexec as suggested it hung with a DOS window
[quoted text clipped - 43 lines]
> > >
> > > Thank you.
Phil Wilson - 14 Feb 2007 15:35 GMT
It's not likely, no. People do uninstalls with logging all the time. Your
system might have an issue. Is your Win32 program a console app? If it is,
that's where the command prompt window is coming from.  It's showing that
and then your app can't run.
My vote is still dependencies. If you haven't got the c run time available
then your program won't load. Visual Studio 2005 C++ apps require sxs 8.0
CRT or statically linked. That's why setup projects have a prerequisites
option to install the redist.
Signature

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

> Phil,
>
[quoted text clipped - 64 lines]
>> > >
>> > > Thank you.
TheClothCat - 15 Feb 2007 15:30 GMT
Phil,

Thanks for the reply.

My Win32 program is a console app which explains the command prompt window.
When I run the console app as custom action after the Install or Commit
phases of installation it works perfectly.

This must mean there is something different about the Uninstall phase. And
before you ask the question, the console app does not depend on anything else
that Uninstall could remove before running the console app. The console app
runs perfectly when started manually from a command prompt window.

This is why I am suspicious that something is wrong with custom actions in
Uninstall in VStudio 2003 SP1.

Do you known if anyone has done this successfully i.e. run a console app as
a custom action after the Uninstall phase in VStudio 2003 SP1?

> It's not likely, no. People do uninstalls with logging all the time. Your
> system might have an issue. Is your Win32 program a console app? If it is,
[quoted text clipped - 72 lines]
> >> > >
> >> > > Thank you.
Phil Wilson - 15 Feb 2007 20:11 GMT
You'll have to be suspicious of everything, including your debugging code. I
ran this program as an uninstall custom action fine, VS 2003, bare bones
program with an include of windows.h for MessageBox.

#include "stdafx.h"

int _tmain(int argc, _TCHAR* argv[])
{
MessageBox (NULL, TEXT("MSG"), TEXT ("SOMETHING"), MB_OK);
return 0;
}

Signature

Phil Wilson
[Microsoft MVP Windows Installer]

> Phil,
>
[quoted text clipped - 109 lines]
>> >> > >
>> >> > > Thank you.
TheClothCat - 19 Feb 2007 11:33 GMT
Hi Phil,

Problem solved. I created a new console project and put your bare bones code
in it and it worked fine as an uninstall custom action. So next I created
another new console project and copied my code from my problematic program
into the new one. Again it works fine!

I don't know what the actual problem was and I don't really want to spend
the time tracking it down. The only things I can think of are that there was
some weird corruption in the one of the project files or maybe some project
setting.

Many thanks for your suggestions.

> You'll have to be suspicious of everything, including your debugging code. I
> ran this program as an uninstall custom action fine, VS 2003, bare bones
[quoted text clipped - 121 lines]
> >> >> > >
> >> >> > > Thank you.
Phil Wilson - 12 Feb 2007 21:08 GMT
p.s. Once you mark a file as permanent, it really does mean permanent! It's
intended for files that must remain on the system, not just until you change
Permanent to false in your setup.
Signature

Phil Wilson
[Microsoft MVP Windows Installer]

> Hi everyone,
>
[quoted text clipped - 25 lines]
>
> Thank you.
H - 15 Mar 2007 13:30 GMT
I have a similar problem with VS2005.  I have an installer class DLL which will
run a DOS batch file fine on Commit.  When I use it to create an Uninstall
custom action, the DOS batch file is not run.

The reason I have to run DOS batch files is because I am installing two COM
libraries.  Neither of these get registered with a code base when I use the
vsd*COM flags on the Project Output or explicit dlls.  So I have to run a
manual regasm as a workaround.  As I said this works fine on Commit, however
the unregister batch file never gets run on UnInstall.

Regards

H

>Hi everyone,
>
[quoted text clipped - 19 lines]
>
>Thank you.

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.