1.  Uhh, that first issue is a bug.  Either the code is wrong or the 
documentation is wrong.  Can you open a bug with information about specifically 
what doesn't work with ExecuteOnInstall/RollbackOnUninstall?

2.  Make the Component permanent.  You may have to your Component smaller 
(generally a good thing) to get the exact behavior you want.


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tim Fisher
Sent: Saturday, June 14, 2008 12:42
To: General discussion for Windows Installer XML toolset.
Subject: Re: [WiX-users] Attach a database

Yes, you're right it does. Ok, your suggestions worked. Now my SQL
scripts run correctly. Thank you!

One thing to note is that if I tried to use ExecuteOnInstall in the
same element with a RollbackOnUninstall, then it doesn't get executed
at all (undocumented).

Anyway I have a new problem, during uninstall. Is there a way to
install these files normally, but leave them alone on uninstall?
(Since they may now contain user data.)

Here's my code now:

<Directory Id="DbDataDir" Name="DATA">
        <Component Id="CmpntBaselineDb" 
Guid="c57c91e1-d185-49c1-91f9-fc41a26298a3">
                <File Id="MDF" Name="Baseline.mdf" Source="Baseline.mdf" 
KeyPath="yes" />
                <File Id="LDF" Name="Baseline_log.ldf" 
Source="Baseline_log.ldf" />
                <sql:SqlString Sequence="1" SqlDb="DB1" ExecuteOnUninstall="yes"
Id="DropUserId" SQL="USE [\[][DBNAME][\]];DROP LOGIN
[USERIDVALUE];DROP USER [USERIDVALUE]" ContinueOnError ="yes" />
                <sql:SqlString Sequence="2" SqlDb="DB1" ExecuteOnUninstall="yes"
Id="DetachDb" SQL="sp_detach_db [\[][DBNAME][\]], true, false"
ContinueOnError="yes" />
                <sql:SqlString Sequence="3" SqlDb="DB1" RollbackOnInstall="yes"
Id="RollbackDb" SQL="USE [\[][DBNAME][\]];DROP LOGIN
[USERIDVALUE];DROP USER [USERIDVALUE];DROP DATABASE [\[][DBNAME][\]]"
ContinueOnError="yes" />
                <sql:SqlString Sequence="4" SqlDb="DB1" ExecuteOnInstall="yes"
Id="AttachDb" SQL="CREATE DATABASE [\[][DBNAME][\]] ON
(FILENAME=N'[#MDF]') FOR ATTACH" ContinueOnError="yes" />
                <sql:SqlString Sequence="5" SqlDb="DB1" ExecuteOnInstall="yes"
Id="CreateUserId" SQL="IF NOT EXISTS ( SELECT * FROM
sys.server_principals WHERE name = N'[USERIDVALUE]' ) CREATE LOGIN
[USERIDVALUE] WITH PASSWORD='[PWDVALUE]', DEFAULT_DATABASE=[DBNAME],
CHECK_POLICY=OFF;USE [DBNAME];IF EXISTS(SELECT name FROM sys.sysusers
WHERE name=N'[USERIDVALUE]')DROP USER [USERIDVALUE];CREATE USER
[USERIDVALUE];EXEC sp_addrolemember db_owner, [USERIDVALUE];"
ContinueOnError="yes" />
        </Component>
</Directory>

Tim

On Fri, Jun 13, 2008 at 2:55 PM, Rob Mensching
<[EMAIL PROTECTED]> wrote:
> We're working on getting the WiX v3 documentation up there.  However, every 
> download of the WiX toolset includes an up to date (as much as we have it) 
> version of the WiX.chm.  That should contain all the information...
>

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to