Hehe... good question. I was wondering how come Don didn't ask this before.
I have to write my own 'undo' Custom Action, that only runs during
uninstall. The reason why these actions are safe, is because the command
prompt will execute the command, and report an error (which the user is
unable to see) - so there are essentially 2 cases: a) the ExeCommand in the
CA succeeds, or b) the CA in the ExeCommand fails. In my case, it doesn't
matter in either case, because if the COM .dll is registered, it'll be
unregistered, and if the COM .dll is not registered (this must also mean
that someone did something bad), the ExeCommand will still allow WIX to
finish its uninstallation procedure. Here is my solution:

<CustomAction Id='Uninstallation' Directory='INSTALLDIR' Win64='no'

ExeCommand='"[WindowsFolder]Microsoft.NET\Framework\v2.0.50727\regasm.exe"
/unregister

"[ProgramFilesFolder]MyCompany\MyProduct\MyLibrary.dll"'

Return='check' />

<InstallExecuteSequence>

<!-- Only run before uninstallation -->

<Custom Action='Uninstallation' Before='RemoveFiles'>Installed AND NOT
REINSTALL</Custom>

</InstallExecuteSequence>

Notice that I run the 'uninstallation' CA only during uninstall, and not
reinstall - you can change this behavior to your needs. Let me if this helps
:)


On 3/22/07, pobox77 <[EMAIL PROTECTED]> wrote:


Hi Dhaval,

Does uninstall work too?
I mean will the dll also deregistered if I uninstall the package?

Thanks in advance,
Peter


Don Tasanasanta wrote:
>
> Your solution helped me find what was wrong with mine. For some reason
> the CA didn't like what I was putting in for the Directory value. I put
> in INSTALLDIR and everything worked great.
>
>
>
> Thanks!
>
>
>
> ________________________________
>
> From: Dhaval Patel [mailto: [EMAIL PROTECTED]
> Sent: Friday, March 09, 2007 4:59 PM
> To: Don Tasanasanta
> Subject: Re: [WiX-users] custom action to reg NET 2.0
>
>
>
> Here is one of my CustomAction elements that I have used in different
> projects - I don't see anything in your CA that will not allow it to
> work, but maybe you want to change the ExeCommand attribute to something
> like I have and give it a shot:
>
> <InstallExecuteSequence>
>
> <Custom Action='Installation' After='InstallFinalize'>NOT
> Installed</Custom>
>
> </InstallExecuteSequence>
>
> <CustomAction Id='Installation' Directory='INSTALLDIR' Win64='no'
>
> ExeCommand='"[WindowsFolder]Microsoft.NET\Framework\v2.0.50727\regasm.ex
> e" /codebase "[ProgramFilesFolder]MyComapny\MyProduct\MyProduct.dll"'
>
>           Return='check' />
>
> This seems to work just fine (i.e. it successfully registers the .dll
> for COM Interop in the registry). I think I had the same issue that you
> are having, but I figured out the solution through trial and error, and
> then I forgot all about it :)
>
> The problem I think is that you may think WIX will execute the CA from
> within the "Directory" ([FRAMEWORKBASEPATH]v2.0.50727 in your case)
> attribute, but that probably is not the case. Notice in my case how I
> explicitly pass all the paths to the ExeCommand attribute directly - I
> don't even worry about the "Directory" attribute (I assume you can set
> it to any valid DirectoryId within your current WIX project, if you
> decide to use the technique I am using). This is probably the reason why
> it is working in my case, and not yours.
>
> Let us all know if this fixes your issue :)
>
>
>
>
> On 3/8/07, Don Tasanasanta <[EMAIL PROTECTED] > wrote:
>
> I have been banging my head against this all day... I'm trying to get
> aspnet_regiis.exe to run and set the ASPNET version to 2.0 for my
> virtual directory.
>
>
>
> Here is my custom action...
>
> <CustomAction Id="SetAspNet" Return="asyncWait"
> Directory="[FRAMEWORKBASEPATH]v2.0.50727" Execute="commit"
> ExeCommand="aspnet_regiis.exe -s W3SVC/1/ROOT/MYWebsite -norestart" />
>
>
>
> Where FRAMEWORKBASEPATH is the path to Framework under Microsoft.NET in
> the WINDOWS folder.
>
>
>
> I have also tried
>
>
>
> <CustomAction Id="VIA3AdminAspNet" Return="asyncWait"
> Property="[ASPNETREGPATH]" Execute="commit" ExeCommand="-s
> W3SVC/1/ROOT/MyWebsite -norestart" />
>
>
>
> Where ASPNETREGPATH is the entire path plus aspnet_regiis.exe
>
>
>
> I have also tried changing the Execute to "immediate" and sequencing the

> custom action after installfinalize.
>
>
>
> Every time I run I get a 1631 return from my custom actions.
>
>
>
> The command line works just fine when run from a cmd prompt. What am I
> missing here?
>
>
> ------------------------------------------------------------------------
> -
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share
> your
> opinions on IT & business topics through brief surveys-and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDE

> V
> _______________________________________________
> WiX-users mailing list
> WiX-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wix-users
>
>
>
>
>
-------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share
> your
> opinions on IT & business topics through brief surveys-and earn cash
>
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> WiX-users mailing list
> WiX-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wix-users
>
>

--
View this message in context:
http://www.nabble.com/custom-action-to-reg-NET-2.0-tf3373202.html#a9611846
Sent from the wix-users mailing list archive at Nabble.com.


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share
your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to