I have some sql scripts that should only be run on initial install and never 
again. Unfortunately, before this was released, the scripts were in such a 
state such that they couldn't detect that they had already been run. So, when 
the component installs during the major upgrade the scripts run again and fail.

If I condition out the component that contains the scripts, it doesn't get 
installed during major upgrade. I see in the log that ComponentRegister then 
registers that component as State=-7. When you finally uninstall, the component 
does not get uninstalled. So, apparently conditioning the component on major 
upgrade causes it to remain upon uninstall.

This normally would be an issue I could live with except that the SqlDatabase 
tag is also part of this component. So, the database will not get removed on 
uninstall because it associated with the component that doesn't get uninstalled 
for some reason I don't understand.

<!-- Create the DB -->
<Component Id="CID_AccountDatabase" 
Guid="{1B56E106-923A-4CDE-82D2-15BC5E7F4165}">
    <Condition>NOT OLDAPPFOUND</Condition>
    <CreateFolder Directory="DATABASEDIR" />
    <RemoveFolder Id="RF_DatabaseDir" Directory="DATABASEDIR" On="uninstall" />
    <Sql:SqlDatabase Id="DBID_Account" Database="SDAaccount" Server="." 
CreateOnInstall="yes" CreateOnReinstall="no" DropOnInstall="no" 
DropOnReinstall="no" DropOnUninstall="yes">
    <Sql:SqlFileSpec Id="FSID_Account" Filename="[DATABASEDIR]Account.mdf" 
Name="SDAaccount" Size="3072KB" MaxSize="Unlimited" GrowthSize="1MB" />

    <!-- CreateLoginWindowsGroup.sql has to be executed before executing 
BID_AccountDatabase -->
    <Sql:SqlScript Id="SQLID_CreateLoginWindowsGroup" ContinueOnError="no" 
ExecuteOnInstall="yes" ExecuteOnReinstall="no" ExecuteOnUninstall="no" 
Sequence="001" BinaryKey="BID_CreateLoginWindowsGroup" />
    <Sql:SqlScript Id="SQLID_CreateUserWindowsGroup" ContinueOnError="no" 
ExecuteOnInstall="yes" ExecuteOnReinstall="no" ExecuteOnUninstall="no" 
Sequence="002" BinaryKey="BID_CreateUserWindowsGroup" />

    <!-- Now create the tables (schema) -->
    <Sql:SqlScript Id="SQLID_Account" ContinueOnError="no" 
ExecuteOnInstall="yes" ExecuteOnReinstall="no" ExecuteOnUninstall="no" 
Sequence="003" BinaryKey="BID_AccountDatabase" />

    <!-- Grant Execute permission on all the SProcs -->
    <Sql:SqlScript Id="SQLID_GrantSProcsExecutePermission" ContinueOnError="no" 
ExecuteOnInstall="yes" ExecuteOnReinstall="no" ExecuteOnUninstall="no" 
Sequence="004" BinaryKey="BID_GrantSProcsExecutePermission" />

    <Sql:SqlScript Id="SQLID_InitialData" ContinueOnError="no" 
ExecuteOnInstall="yes" ExecuteOnReinstall="no" ExecuteOnUninstall="no" 
Sequence="005" BinaryKey="BID_InitialData" />
    <Sql:SqlScript Id="SQLID_RevokePermission_GuestUser" ContinueOnError="no" 
ExecuteOnInstall="yes" ExecuteOnReinstall="no" ExecuteOnUninstall="no" 
Sequence="006" BinaryKey="BID_RevokePermission_GuestUser" />
    </Sql:SqlDatabase>
</Component>


Log snippets:
Install:
Component: CID_AccountDatabase; Installed: Absent;   Request: Local;   Action: 
Local
ComponentRegister(ComponentId={1B56E106-923A-4CDE-82D2-15BC5E7F4165},KeyPath=C:\blah\,State=3,,Disk=1,SharedDllRefCount=0,BinaryType=0)

Major Upgrade:
Component: CID_AccountDatabase; Installed: Absent;   Request: Local;   Action: 
Null
ComponentRegister(ComponentId={1B56E106-923A-4CDE-82D2-15BC5E7F4165},,State=-7,,Disk=1,SharedDllRefCount=0,BinaryType=0)

Uninstall:
Component: CID_AccountDatabase; Installed: Local;   Request: Absent;   Action: 
Null
ComponentUnregister(ComponentId={1B56E106-923A-4CDE-82D2-15BC5E7F4165},,BinaryType=0,PreviouslyPinned=1)


My understanding of the component states is as follows. Please tell me if or 
where I'm mistaken.
Install:
Installed: Absent - this component is not installed
Request: Local - the component should be installed locally
Action: Local - the component will be installed locally

Major Upgrade:
Installed: Absent - ?
Request: Local - the component should be installed locally unless conditioned 
out
Action: Null - the component will not be installed because it was conditioned 
out

Uninstall:
Installed: Local - the component is installed locally
Request: Absent - the component is requested to be removed
Action: Null - ?



1.)    I don't understand the logging from the upgrade. Why does it list 
"Installed" as "Absent" when it really is installed?

2.)    During uninstall, why is the "Action" listed as "Null" indicating not to 
uninstall yet the ComponentUnregsiter is removing the component registration as 
though the component is being uninstalled?

Any help in understanding is appreciated.
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to