Hi Mike, Are you saying that you do all your db work in the custom action, and not in the SqlScript and SqlString tags?
On Wed, Feb 24, 2010 at 1:14 AM, Matt Lynch <m...@bonafidesoftware.com> wrote: > +1 - I did it this way too, but with a single home grown custom action which > decides which properties to set. My custom action uses > ConnectionStringBuilder to construct a nice conn string which the installer > can use. I'm supporting a bunch of other db types and this method seemed to > be the best of a bad bunch of options. > > Cheers > > ----- Original Message ----- > From: "Mike Rerick" <mrer...@iwsinc.com> > To: "General discussion for Windows Installer XML toolset." > <wix-users@lists.sourceforge.net> > Sent: Wednesday, February 24, 2010 2:36 AM > Subject: Re: [WiX-users] How to select between SQL Authentication > andIntegrated Authentication during the install of the msi? > > >> This is what I have done for all of my database installs. I took the >> standard FeatureTree and extended it with some additional screens. I use a >> third party custom action to get a list of db servers that are available. >> Hope this helps. >> >> Also, see http://wix.mindcapers.com/wiki/WiX_and_SQLServer >> >> >> In my main WIX file: >> >> <sql:SqlDatabase Id="SqlDb" Database="$(var.DatabaseName)" >> Server="[SELECTEDSQLSERVER]" User="SQLAdminUser"/> >> <sql:SqlDatabase Id="SqlDbWindows" Database="$(var.DatabaseName)" >> Server="[SELECTEDSQLSERVER]"/> >> >> <Component Id="CreateDatabaseTablesAndDataServer" DiskId="1" >> KeyPath="yes" >> Guid="{YOUR_GUID_HERE}"> >> <Condition>SQLSERVER_AUTHENTICATION = "Server"</Condition> >> <sql:SqlScript Id="create_db_1_server" >> BinaryKey="CreateDbSqlScript" SqlDb="SqlDb" >> User="SQLAdminUser" ExecuteOnInstall="yes" >> ExecuteOnUninstall="no" >> ContinueOnError="no" Sequence="1"/> >> </Component> >> <Component Id="CreateDatabaseTablesAndDataWindows" DiskId="1" >> KeyPath="yes" >> Guid="{YOUR_GUID_HERE}"> >> <Condition>SQLSERVER_AUTHENTICATION = "Windows"</Condition> >> <sql:SqlScript Id="create_db_1_windows" >> BinaryKey="CreateDbSqlScript" SqlDb="SqlDbWindows" >> ExecuteOnInstall="yes" ExecuteOnUninstall="no" >> ContinueOnError="no" Sequence="1"/> >> </Component> >> >> >> I took Feature Tree wix source and added custom screens to it. This is in >> a >> separate include file. >> >> <?xml version="1.0" encoding="UTF-8"?> >> <Include xmlns="http://schemas.microsoft.com/wix/2006/wi"> >> <!-- >> This is the UI from the >> <wix-path>\src\ext\UIExtension\wixlib\WixUI_FeatureTree.wxs file. >> It has the custom dialog to get the database admin username and >> password inserted into the sequence of dialogs >> between CustomizeDlg and VerifyReadyDlg. >> --> >> <!-- Make sure that these tables get created in the installer, even if >> they are empty --> >> <EnsureTable Id="ComboBox"/> >> <EnsureTable Id="ListBox"/> >> >> <UIRef Id="WixUI_Common"/> >> <UI> >> <!-- <ProgressText Action="D4WFillSQLServersListbox">Getting the >> local database servers, please wait...</ProgressText>--> >> <ProgressText Action="D4WFillSQLServersListbox">Getting a list of >> available database servers, please wait...</ProgressText> >> <ProgressText Action="D4WFillSQLServersListboxNetwork">Getting a >> list of network database servers, please wait...</ProgressText> >> >> <!-- DBA Login dialog text - My properties for the DBA login dialog >> page --> >> <Property Id="DbServerText" Value="Select database server and >> connection method"/> >> <Property Id="DbServerExplainText1" >> Value="Select the database server to install to from the >> list below."/> >> <Property Id="DbServerExplainText2" >> Value=" You can also specify the way to authenticate your >> login using your "/> >> <Property Id="DbServerExplainText3" Value="current Windows >> credentials or a SQL Login ID and Password."/> >> <Property Id="DbaLoginTitle" Value="Database Admin Login"/> >> <Property Id="DbaLoginText" >> Value="Please enter the DBA username and password for your >> database server"/> >> <Property Id="DbaUsernameLabel" Value="DBA Username: "/> >> <Property Id="DbaPasswordLabel" Value="DBA Password:"/> >> <Property Id="DbaLoginBackButtonText" Value="&Back"/> >> <Property Id="DbaLoginNextButtonText" Value="&Next"/> >> <Property Id="DBAUSERNAME" Secure="yes"/> >> <Property Id="DBAPASSWORD" Hidden="yes" Secure="yes"/> >> <Property Id="DBSERVERNAME" Value="Express"/> >> <Property Id="SQLSERVER_AUTHENTICATION" Value="Server"/> >> >> <ComboBox Property="SQLSERVER_SERVER_TO_USE"> >> <ListItem Value="TestValue" /> >> </ComboBox> >> <ComboBox Property="D4WSQLSERVER"> >> <!--<ListItem Value="(local)" />--> >> </ComboBox> >> >> <RadioButtonGroup Property="SQLSERVER_AUTHENTICATION"> >> <RadioButton Height="14" Text="Windows authentication >> credentials >> of current user" Value="Windows" Width="250" X="0" Y="0" /> >> <RadioButton Height="19" Text="Server authentication using the >> Login ID and password below" Value="Server" Width="250" X="0" Y="14" /> >> </RadioButtonGroup> >> >> <TextStyle Id="WixUI_Font_Normal" FaceName="Tahoma" Size="8"/> >> <TextStyle Id="WixUI_Font_Bigger" FaceName="Tahoma" Size="12"/> >> <TextStyle Id="WixUI_Font_Title" FaceName="Tahoma" Size="9" >> Bold="yes"/> >> >> <Property Id="DefaultUIFont" Value="WixUI_Font_Normal"/> >> <Property Id="WixUI_Mode" Value="FeatureTree"/> >> >> <DialogRef Id="ErrorDlg"/> >> <DialogRef Id="FatalError"/> >> <DialogRef Id="FilesInUse"/> >> <DialogRef Id="MsiRMFilesInUse"/> >> <DialogRef Id="PrepareDlg"/> >> <DialogRef Id="ProgressDlg"/> >> <DialogRef Id="ResumeDlg"/> >> <DialogRef Id="UserExit"/> >> >> <Publish Dialog="ExitDialog" Control="Finish" Event="EndDialog" >> Value="Return" Order="999">1</Publish> >> >> <Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" >> Value="LicenseAgreementDlg">1</Publish> >> >> <Publish Dialog="LicenseAgreementDlg" Control="Back" >> Event="NewDialog" Value="WelcomeDlg">1</Publish> >> <Publish Dialog="LicenseAgreementDlg" Control="Next" >> Event="NewDialog" Value="CustomizeDlg">LicenseAccepted = "1"</Publish> >> >> <Publish Dialog="CustomizeDlg" Control="Back" Event="NewDialog" >> Value="MaintenanceTypeDlg" Order="1">OLDERVERSIONBEINGUPGRADED</Publish> >> <Publish Dialog="CustomizeDlg" Control="Back" Event="NewDialog" >> Value="LicenseAgreementDlg" Order="2">NOT >> OLDERVERSIONBEINGUPGRADED</Publish> >> <Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" >> Value="DatabaseServerDlg">1</Publish> >> >> <Publish Dialog="DatabaseServerDlg" Control="Back" >> Event="NewDialog" >> Value="CustomizeDlg">1</Publish> >> <Publish Dialog="DatabaseServerDlg" Control="Next" >> Event="NewDialog" >> Value="VerifyReadyDlg">1</Publish> >> >> <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" >> Value="DatabaseServerDlg" Order="1">(NOT OLDERVERSIONBEINGUPGRADED) OR >> (WixUI_InstallMode = "Change")</Publish> >> <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" >> Value="MaintenanceTypeDlg" Order="2">OLDERVERSIONBEINGUPGRADED</Publish> >> >> <Publish Dialog="MaintenanceWelcomeDlg" Control="Next" >> Event="NewDialog" Value="MaintenanceTypeDlg">1</Publish> >> >> <Publish Dialog="MaintenanceTypeDlg" Control="ChangeButton" >> Event="NewDialog" Value="CustomizeDlg">1</Publish> >> <Publish Dialog="MaintenanceTypeDlg" Control="RepairButton" >> Event="NewDialog" Value="VerifyReadyDlg">1</Publish> >> <Publish Dialog="MaintenanceTypeDlg" Control="RemoveButton" >> Event="NewDialog" Value="VerifyReadyDlg">1</Publish> >> <Publish Dialog="MaintenanceTypeDlg" Control="Back" >> Event="NewDialog" Value="MaintenanceWelcomeDlg">1</Publish> >> >> <Dialog Id="DatabaseServerDlg" Width="370" Height="270" >> Title="[ProductName] Database Server"> >> <Control Id="Title" Type="Text" X="15" Y="6" Width="200" >> Height="15" Transparent="yes" >> NoPrefix="yes" Text="{\WixUI_Font_Title}Database Server >> Information"/> >> <Control Id="Description" Type="Text" X="25" Y="23" Width="280" >> Height="15" >> Transparent="yes" NoPrefix="yes" Text="Enter the following >> information to facilitate the installation"/> >> <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" >> Width="370" >> Height="44" >> TabSkip="no" Text="!(loc.InstallDirDlgBannerBitmap)"/> >> <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" >> Height="0"/> >> >> <!-- My code added to the stock look and feel for a dialog --> >> <Control Id="DatabaseServerPurposeText" Type="Text" Height="20" >> Width="320" X="20" Y="50" Text="[DlgTitleFont][DbServerText]" >> Transparent="yes" NoPrefix="yes"/> >> >> <Control Id="DatabaseServerLabel" Type="Text" Height="20" >> Width="75" X="20" Y="67" Text="Database Server: " Transparent="yes" >> NoPrefix="yes"/> >> <Control Id="ServerComboBoxList" Type="ListBox" Height="80" >> Width="270" X="20" Y="81" Property="D4WSQLSERVER" TabSkip="no" >> Sorted="yes"/> >> >> <Control Id="ConnectTypeRadioButtons" Type="RadioButtonGroup" >> Height="50" Width="250" X="25" Y="161" Property="SQLSERVER_AUTHENTICATION" >> TabSkip="no"/> >> >> <Control Id="AuthLoginIdLabelText" Type="Text" Height="20" >> Width="60" X="50" Y="196" Text="[LoginIdLabel]" Transparent="yes" >> NoPrefix="yes"> >> <Condition >> Action="disable">SQLSERVER_AUTHENTICATION="Windows"</Condition> >> <Condition >> Action="enable">SQLSERVER_AUTHENTICATION="Server"</Condition> >> </Control> >> <Control Id="AuthUsernameDataEntry" Type="Edit" Height="17" >> Width="130" X="95" Y="194" Property="DBAUSERNAME" TabSkip="no"> >> <Condition >> Action="disable">SQLSERVER_AUTHENTICATION="Windows"</Condition> >> <Condition >> Action="enable">SQLSERVER_AUTHENTICATION="Server"</Condition> >> </Control> >> <Control Id="AuthPasswordLabelText" Type="Text" Height="20" >> Width="60" X="50" Y="216" Text="[PasswordLabel]" Transparent="yes" >> NoPrefix="yes"> >> <Condition >> Action="disable">SQLSERVER_AUTHENTICATION="Windows"</Condition> >> <Condition >> Action="enable">SQLSERVER_AUTHENTICATION="Server"</Condition> >> </Control> >> <Control Id="AuthPasswordDataEntry" Type="Edit" Password="yes" >> Height="17" Width="130" X="95" Y="214" Property="DBAPASSWORD" >> TabSkip="no"> >> <Condition >> Action="disable">SQLSERVER_AUTHENTICATION="Windows"</Condition> >> <Condition >> Action="enable">SQLSERVER_AUTHENTICATION="Server"</Condition> >> </Control> >> <!-- End of my code --> >> >> <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" >> Height="0"/> >> <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" >> Height="17" Default="yes" Text="&Next"> >> <Publish Event="SpawnDialog" >> Value="NoDatabaseServerSelectedDlg"><![CDATA[D4WSQLSERVER = >> ""]]></Publish> >> <Publish Event="SpawnDialog" >> Value="NoAdminPasswordEnteredDlg"><![CDATA[(DBAPASSWORD = "") AND >> (SQLSERVER_AUTHENTICATION = "Server")]]></Publish> >> <Publish Property="D4WSQLSERVER" >> Value="[D4WSQLSERVER]"><![CDATA[NOT (D4WSQLSERVER="")]]></Publish> >> <Publish Event="DoAction" >> Value="SetSelectedSqlServer">1</Publish> >> </Control> >> <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" >> Height="17" Text="&Back"/> >> <Control Id="Cancel" Type="PushButton" X="304" Y="243" >> Width="56" Height="17" Cancel="yes" Text="&Cancel"> >> <Publish Event="SpawnDialog" Value="CancelDlg">1</Publish> >> </Control> >> </Dialog> >> >> <Dialog Id="NoDatabaseServerSelectedDlg" Width="370" Height="270" >> Title="[ProductName] No Database Server Selected"> >> <Control Id="Title" Type="Text" X="15" Y="6" Width="200" >> Height="15" Transparent="yes" >> NoPrefix="yes" Text="{\WixUI_Font_Title}No Database Server >> Selected"/> >> <Control Id="Description" Type="Text" X="25" Y="23" Width="280" >> Height="15" >> Transparent="yes" NoPrefix="yes" Text="Select the database >> sever on which to install the CATSA CID database"/> >> <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" >> Width="370" >> Height="44" >> TabSkip="no" Text="!(loc.InstallDirDlgBannerBitmap)"/> >> <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" >> Height="0"/> >> >> <!-- My code added to the stock look and feel for a dialog --> >> <Control Id="InvalidServerText" Type="Text" X="30" Y="70" >> Width="194" Height="30" Transparent="yes" NoPrefix="yes"> >> <Text>{\WixUI_Font_Title}No database server has been >> selected.</Text> >> </Control> >> <!-- End of my code --> >> >> <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" >> Height="0"/> >> <Control Id="OK" Type="PushButton" X="236" Y="243" Width="56" >> Height="17" Default="yes" Text="&OK"> >> <Publish Event="EndDialog" Value="Return">1</Publish> >> </Control> >> <Control Id="Cancel" Type="PushButton" X="304" Y="243" >> Width="56" Height="17" Cancel="yes" Text="&Cancel"> >> <Publish Event="EndDialog" Value="Return">1</Publish> >> </Control> >> </Dialog> >> >> <Dialog Id="NoAdminPasswordEnteredDlg" Width="370" Height="270" >> Title="[ProductName] No Database Login Password Was Entered"> >> <Control Id="Title" Type="Text" X="15" Y="6" Width="200" >> Height="15" Transparent="yes" >> NoPrefix="yes" Text="{\WixUI_Font_Title}No Database Login >> Password Was Entered"/> >> <Control Id="Description" Type="Text" X="25" Y="23" Width="280" >> Height="15" >> Transparent="yes" NoPrefix="yes" Text="Enter the password >> for the database administrative user"/> >> <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" >> Width="370" >> Height="44" >> TabSkip="no" Text="!(loc.InstallDirDlgBannerBitmap)"/> >> <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" >> Height="0"/> >> >> <!-- My code added to the stock look and feel for a dialog --> >> <Control Id="InvalidServerText" Type="Text" X="30" Y="70" >> Width="194" Height="30" Transparent="yes" NoPrefix="yes"> >> <Text>{\WixUI_Font_Title}No database login password was >> entered.</Text> >> </Control> >> <!-- End of my code --> >> >> <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" >> Height="0"/> >> <Control Id="OK" Type="PushButton" X="236" Y="243" Width="56" >> Height="17" Default="yes" Text="&OK"> >> <Publish Event="EndDialog" Value="Return">1</Publish> >> </Control> >> <Control Id="Cancel" Type="PushButton" X="304" Y="243" >> Width="56" Height="17" Cancel="yes" Text="&Cancel"> >> <Publish Event="EndDialog" Value="Return">1</Publish> >> </Control> >> </Dialog> >> </UI> >> </Include> >> >> >> >> >> On Tue, Feb 23, 2010 at 12:01 AM, Peter Joseph Solomon < >> pe...@nextsteps.co.za> wrote: >> >>> I have the following example which uses two components each with a >>> condition to select which component to run. One component uses a >>> database linked to an SQL Authenticated User and the other to no user >>> (Integrated Authentication). >>> >>> Command line options are passed, either USEINTEGRATEDSECURITY=1 or >>> USER=sa and PASSWORD=superadmin for either Integrated Authentication >>> or SQL Authentication respectivly. >>> >>> This works fine, except it will be error prone maintaining the MSI. >>> >>> I am looking for a way to achieve the same result, but with out having >>> to use two components. So just one component, but a way to instruct >>> the database/user to which authentication type it will use. >>> Any suggestions? >>> >>> Kind regards >>> Peter >>> >>> Example: >>> <Binary Id="CreateTable" SourceFile="$(var.SolutionDir)\CreateTable.sql" >>> /> >>> >>> <util:User Id='SQLUser' Name='[USER]' Password='[PASSWORD]' /> >>> >>> <sql:SqlDatabase Id='SqlDatabase.SQLAuthentication' >>> Database='IMAGETEST' User='SQLUser' Server='server' /> >>> <sql:SqlDatabase Id='SqlDatabase.IntegratedAuthentication' >>> Database='IMAGETEST' Server='server' /> >>> >>> <Directory Id='TARGETDIR' Name='SourceDir'> >>> <Directory Id='ProgramFilesFolder' Name='PFiles'> >>> <Directory Id='InstallDir' Name='Acme'> >>> >>> <Component Id='SqlComponent.SQLAuthentication' >>> Guid='665D641C-3570-4b96- 9CA5-2B4C12594A35' KeyPath='yes'> >>> <Condition><![CDATA[USEINTEGRATEDSECURITY<>1]]></Condition> >>> <sql:SqlScript Id='CreateTable' BinaryKey='CreateTable' >>> SqlDb='SqlDatabase.SQLAuthentication' ExecuteOnInstall='yes' /> >>> </Component> >>> >>> <Component Id='SqlComponent.IntegratedAuthentication' >>> Guid='E5DF48AE-2338-4029-9FDF-8DAA6AD0216D' KeyPath='yes'> >>> <Condition>USEINTEGRATEDSECURITY = 1</Condition> >>> <sql:SqlScript Id='IntegratedAuthentication.CreateTable' >>> BinaryKey='CreateTable' SqlDb='SqlDatabase.IntegratedAuthentication' >>> ExecuteOnInstall='yes' /> >>> </Component> >>> >>> </Directory> >>> </Directory> >>> </Directory> >>> >>> <Feature Id='SqlFeature' Title='SqlFeature' Level='1'> >>> <ComponentRef Id='SqlComponent.SQLAuthentication' /> >>> <ComponentRef Id='SqlComponent.IntegratedAuthentication' /> >>> </Feature> >>> >>> >>> ------------------------------------------------------------------------------ >>> Download Intel® Parallel Studio Eval >>> Try the new software tools for yourself. Speed compiling, find bugs >>> proactively, and fine-tune applications for parallel performance. >>> See why Intel Parallel Studio got high marks during beta. >>> http://p.sf.net/sfu/intel-sw-dev >>> _______________________________________________ >>> WiX-users mailing list >>> WiX-users@lists.sourceforge.net >>> https://lists.sourceforge.net/lists/listinfo/wix-users >>> >> >> The information contained in this transmission contains potentially >> privileged, export controlled and/or confidential information of Imageware >> Systems, Inc. or its customers or partners. It is intended only to be >> read by the person(s) named above and for no other purpose. You are >> hereby notified that any dissemination, distribution, duplication of this >> communication or use of its contents for any purpose not authorized >> expressly by Imageware Systems, Inc. is strictly prohibited and could lead >> to both civil and/or criminal penalties. If you are not the intended >> recipient, you are prohibited to review the contents herein and please >> contact the sender by reply e-mail and destroy all copies of the original >> message. To reply to our e-mail administrator directly, please send an >> e-mail to emailad...@iwsinc.com >> ------------------------------------------------------------------------------ >> Download Intel® Parallel Studio Eval >> Try the new software tools for yourself. Speed compiling, find bugs >> proactively, and fine-tune applications for parallel performance. >> See why Intel Parallel Studio got high marks during beta. >> http://p.sf.net/sfu/intel-sw-dev >> _______________________________________________ >> WiX-users mailing list >> WiX-users@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/wix-users >> > > > > ------------------------------------------------------------------------------ > Download Intel® Parallel Studio Eval > Try the new software tools for yourself. Speed compiling, find bugs > proactively, and fine-tune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev > _______________________________________________ > WiX-users mailing list > WiX-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wix-users > ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users