WIX数据库部署,安装

在我的设置过程中,我提供一个选项来使用“ Windows身份验证”或“服务器授权”.一切正常,只要我做“服务器身份验证”,并提供db userId和密码,db就会安装.

使用“Windows身份验证”(以wix为单位)安装db需要做什么?
谢谢

我的product.wxs文件

<Product Id="*" Name="MySetup2" Language="1033" Version="1.0.0.0" Manufacturer="Hewlett-Packard Company" UpgradeCode="bf1da750-c2fe-4026-9d2b-9d291a61a8b5">
    <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />

    <Binary Id="success_bmp" SourceFile="$(sys.soURCEFILEDIR)success.bmp" />
    <Binary Id="error_bmp" SourceFile="$(sys.soURCEFILEDIR)error.bmp" />

    <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
    <MediaTemplate />

    <Feature Id="ProductFeature" Title="MySetup2" Level="1" ConfigurableDirectory="INSTALLDIR">
        <ComponentGroupRef Id="ProductComponents" />
        <ComponentGroupRef Id='MvcApp'/>
        <ComponentRef Id='sqlComponent' />
    </Feature>
    <Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR" />

    <Binary Id="CreateTableScript"  SourceFile="c:\Temp\MyDb.sql" />

    <!-- Specify UI -->
    <UIRef Id="MyWebUI" />

    <!-- .NET Framework 3.0 SP 1 must be installed -->
    <Property Id="FRAMEWORKBASEPATH">
        <RegistrySearch Id="FindFrameworkdir" Root="HKLM" Key="SOFTWARE\Microsoft\.NETFramework" Name="installroot" Type="raw"/>
    </Property>

   <util:User Id="sqlUser" Name="[DATABASE_USERNAME]" Password="[DATABASE_PASSWORD]" />   
</Product>


<Fragment>
    <Directory Id="TARGETDIR" Name="SourceDir">
        <Directory Id="ProgramFilesFolder">
            <Directory Id="INSTALLDIR" Name="MySetup2" >
                <!--<Component Id="Web.config" Guid="2ED81B77-F153-4003-9006-4770D789D4B6">
                    <File Id="Web.config" Name="Web.config" Source="$(var.solutionDir)MvcApplication4\Web.config" diskId="1" KeyPath="yes" />
                    <util:XmlFile Id="AppSettingsAddNode" File="[INSTALLDIR]Web.config" Action="createElement" ElementPath="/configuration/appSettings" Name="add" Sequence="1" />
                    <util:XmlFile Id="AppSettingsKeyAttribute" Action="setValue" File="[INSTALLDIR]Web.config" ElementPath="/configuration/appSettings/add" Name="key" Value="AddedDuringInstall" Sequence="2" />
                    <util:XmlFile Id="AppSettingsValueAttribute" Action="setValue" File="[INSTALLDIR]Web.config" ElementPath="/configuration/appSettings/add" Name="value" Value="This text was added during installation." Sequence="3" />
                </Component>
                <Directory Id="binFolder" Name="bin">
                    <Component Id="MvcApplication4.dll" Guid="7FC6DA37-12E5-463d-8E7E-08F73E40CCF2">
                        <File Id="MvcApplication4.dll" Name="MvcApplication4.dll" Source="$(var.solutionDir)MvcApplication4\Bin\MvcApplication4.dll" diskId="1" KeyPath="yes" />
                    </Component>
                </Directory>-->

            </Directory>            
        </Directory>


        <Component Id="sqlComponent" Guid="C50999A0-02FD-42d5-9F65-7375318DD328">
            <sql:sqlDatabase Id="sqlDatabase" 
                            Database="[DATABASE_NAME]" 
                            Server="[DATABASE_SERVER]" 
                            CreateOnInstall="yes" 
                            DropOnUninstall="yes" 
                            User="sqlUser">
                <sql:sqlScript Id="CreateTableScript" ExecuteOnInstall="yes" BinaryKey="CreateTableScript" />
            </sql:sqlDatabase>  
        </Component>



    </Directory>

</Fragment>

<Fragment>
    <ComponentGroup Id="ProductComponents" Directory="INSTALLDIR">
        <!-- Todo: Remove the comments around this Component element and the ComponentRef below in order to add resources to this installer. -->
        <!-- <Component Id="ProductComponent"> -->
        <!-- Todo: Insert files,registry keys,and other resources here. -->
        <!-- </Component> -->
    </ComponentGroup>
</Fragment>

当我修改此部分并删除用户标签时,它可以使用Windows身份验证.如何添加标签或根据UI的选择删除它(条件).

<sql:sqlDatabase Id="sqlDatabase" 
                        Database="[DATABASE_NAME]" 
                        Server="[DATABASE_SERVER]" 
                        CreateOnInstall="yes" 
                        DropOnUninstall="yes" 
                        User="sqlUser">

解决方法

解决了它,并创建了WIX数据库安装程序:

Product.wxs:

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
     xmlns:iis="http://schemas.microsoft.com/wix/IIsExtension"
     xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"
     xmlns:sql="http://schemas.microsoft.com/wix/sqlExtension">

    <Product Id="*" Name="MySetup2" Language="1033" Version="1.0.0.0" Manufacturer="Hewlett-Packard Company" UpgradeCode="bf1da750-c2fe-4026-9d2b-9d291a61a8b5">
        <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />

        <Binary Id="success_bmp" SourceFile="$(sys.soURCEFILEDIR)success.bmp" />
        <Binary Id="error_bmp" SourceFile="$(sys.soURCEFILEDIR)error.bmp" />

        <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
        <MediaTemplate />

        <Feature Id="ProductFeature" Title="MySetup2" Level="1" ConfigurableDirectory="INSTALLDIR">
            <ComponentGroupRef Id="ProductComponents" />
            <ComponentRef Id='sqlComponent.IntegratedAuthentication' />
            <ComponentRef Id='sqlComponent.sqlAuthentication' />
        </Feature>
        <Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR" />

        <Binary Id="sqlScriptsqlAuthentication"  SourceFile="c:\Temp\MyDb.sql" />
        <Binary Id="sqlScriptIntegratedAuthentication"  SourceFile="c:\Temp\MyDb.sql" />

        <!-- .NET Framework 3.0 SP 1 must be installed -->
        <Property Id="FRAMEWORKBASEPATH">
            <RegistrySearch Id="FindFrameworkdir" Root="HKLM" Key="SOFTWARE\Microsoft\.NETFramework" Name="installroot" Type="raw"/>
        </Property>
        <UIRef Id="MyWebUI" />
       <util:User Id="sqlUser" Name="[DATABASE_USERNAME]" Password="[DATABASE_PASSWORD]" />

        <Property Id='DATABASE_USERNAME'></Property>
        <Property Id='DATABASE_PASSWORD'></Property>
        <Property Id='DATABASE_NAME'></Property>
        <Property Id="DATABASE_SERVER">(local)</Property>
        <Property Id="DATABASE_logoN_TYPE">DatabaseIntegratedAuth</Property>
        <Property Id="USEINTEGRATEDSecurity" Secure="yes"></Property>
    </Product>


    <Fragment>
        <Directory Id="TARGETDIR" Name="SourceDir">
            <Directory Id="ProgramFilesFolder">
                <Directory Id="INSTALLDIR" Name="MySetup2" >
                </Directory>            
            </Directory>

            <Component Id='sqlComponent.sqlAuthentication' Guid='665D641C-3570-4b96-9CA5-2B4C12594A35' KeyPath='yes'>
                <Condition><![CDATA[USEINTEGRATEDSecurity<>1]]></Condition>
                <sql:sqlDatabase Id='sqlDatabase.sqlAuthentication' Database='[DATABASE_NAME]' User='sqlUser' Server='[DATABASE_SERVER]' CreateOnInstall='yes' DropOnUninstall='yes' ContinueOnError='no' />
                <sql:sqlScript Id='sqlScriptsqlAuthentication' BinaryKey='sqlScriptsqlAuthentication' sqlDb='sqlDatabase.sqlAuthentication' ExecuteOnInstall='yes' />
            </Component>

            <Component Id='sqlComponent.IntegratedAuthentication' Guid='E5DF48AE-2338-4029-9FDF-8DAA6AD0216D' KeyPath='yes'>
                <Condition>USEINTEGRATEDSecurity = 1</Condition>
                <sql:sqlDatabase Id='sqlDatabase.IntegratedAuthentication' Database='[DATABASE_NAME]' Server='[DATABASE_SERVER]' CreateOnInstall='yes' DropOnUninstall='yes' ContinueOnError='no' />
                <sql:sqlScript Id='sqlScriptIntegratedAuthentication' BinaryKey='sqlScriptIntegratedAuthentication' sqlDb='sqlDatabase.IntegratedAuthentication' ExecuteOnInstall='yes' />
            </Component>

        </Directory>

    </Fragment>

    <Fragment>
        <ComponentGroup Id="ProductComponents" Directory="INSTALLDIR">
            <!-- Todo: Remove the comments around this Component element and the ComponentRef below in order to add resources to this installer. -->
            <!-- <Component Id="ProductComponent"> -->
            <!-- Todo: Insert files,and other resources here. -->
            <!-- </Component> -->
        </ComponentGroup>
    </Fragment>
</Wix>

注意“条件”操作符基于Windows身份验证与服务器身份验证.

自定义操作:

namespace CustomActions
{
    using System;
    using System.Collections.Generic;
    using System.Data;
    using System.Data.sqlClient;
    using System.Diagnostics;
    using System.Security.Principal;
    using Microsoft.Deployment.WindowsInstaller;
    using Microsoft.sqlServer.Management.Smo;
    using View = Microsoft.Deployment.WindowsInstaller.View;

    public static class CustomActions
    {
        #region Public Methods and Operators

        [CustomAction]
        public static ActionResult EnumeratesqlServers(Session session)
        {
            if (null == session)
            {
                throw new ArgumentNullException("session");
            }

            session.Log("EnumeratesqlServers: Begin");

            // Check if running with admin rights and if not,log a message to
            // let them kNow why it's failing.
            if (false == HasAdminRights())
            {
                session.Log("EnumeratesqlServers: " + "ATTEMPTING TO RUN WITHOUT ADMIN RIGHTS");
                return ActionResult.Failure;
            }

            ActionResult result;

            DataTable dt = SmoApplication.EnumAvailablesqlServers(false);
            DaTarow[] rows = dt.Select(string.Empty,"IsLocal desc,Name asc");
            result = EnumsqlServersIntoComboBox(session,rows);

            session.Log("EnumeratesqlServers: End");
            return result;
        }

        [CustomAction]
        public static ActionResult VerifysqlConnection(Session session)
        {
            try
            {
                //Debugger.Break();

                session.Log("VerifysqlConnection: Begin");

                var builder = new sqlConnectionStringBuilder
                                  {
                                      DataSource = session["DATABASE_SERVER"],InitialCatalog = "master",ConnectTimeout = 5
                                  };

                if (session["DATABASE_logoN_TYPE"] != "DatabaseIntegratedAuth")
                {
                    builder.UserID = session["DATABASE_USERNAME"];
                    builder.Password = session["DATABASE_PASSWORD"];
                }
                else
                {
                    builder.IntegratedSecurity = true;
                }

                using (var connection = new sqlConnection(builder.ConnectionString))
                {
                    if (connection.CheckConnection(session))
                    {
                        session["ODBC_CONNECTION_ESTABLISHED"] = "1";
                    }
                    else
                    {
                        session["ODBC_CONNECTION_ESTABLISHED"] = string.Empty;
                    }
                }

                session.Log("VerifysqlConnection: End");
            }
            catch (Exception ex)
            {
                session.Log("VerifysqlConnection: exception: {0}",ex.Message);
                throw;
            }

            return ActionResult.Success;
        }

        #endregion

        #region Methods

        private static ActionResult EnumsqlServersIntoComboBox(Session session,IEnumerable<DaTarow> rows)
        {
            try
            {
                //Debugger.Break();

                session.Log("EnumsqlServers: Begin");

                View view = session.Database.OpenView("DELETE FROM ComboBox WHERE ComboBox.Property='DATABASE_SERVER'");
                view.Execute();

                view = session.Database.OpenView("SELECT * FROM ComboBox");
                view.Execute();

                Int32 index = 1;
                session.Log("EnumsqlServers: Enumerating sql servers");
                foreach (DaTarow row in rows)
                {
                    String serverName = row["Name"].ToString();

                    // Create a record for this web site. All I care about is
                    // the name so use it for fields three and four.
                    session.Log("EnumsqlServers: Processing sql server: {0}",serverName);

                    Record record = session.Database.CreateRecord(4);
                    record.SetString(1,"DATABASE_SERVER");
                    record.SetInteger(2,index);
                    record.SetString(3,serverName);
                    record.SetString(4,serverName);

                    session.Log("EnumsqlServers: Adding record");
                    view.Modify(ViewModifyMode.InsertTemporary,record);
                    index++;
                }

                view.Close();

                session.Log("EnumsqlServers: End");
            }
            catch (Exception ex)
            {
                session.Log("EnumsqlServers: exception: {0}",ex.Message);
                throw;
            }

            return ActionResult.Success;
        }

        private static bool HasAdminRights()
        {
            WindowsIdentity identity = WindowsIdentity.GetCurrent();
            var principal = new WindowsPrincipal(identity);
            return principal.IsInRole(WindowsBuiltInRole.Administrator);
        }

        private static bool CheckConnection(this sqlConnection connection,Session session)
        {
            try
            {
                if (connection == null)
                {
                    return false;
                }

                connection.open();
                var canopen = connection.State == ConnectionState.Open;
                connection.Close();

                return canopen;
            }
            catch (sqlException ex)
            {
                session["ODBC_ERROR"] = ex.Message;
                return false;
            }
        }

        #endregion
    }
}

MyWebUI.wxs

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Fragment>
        <EnsureTable Id='ComboBox'/>

         <!--The custom action DLL itself.-->
        <Binary Id="WebAppCA"
                SourceFile="C:\Temp\MvcApplication4a\CustomActions\bin\Debug\CustomActions.CA.dll" />

         <!--The custom action to enumerate the web sites and app pools into the 
         appropriate combo Boxes.-->
        <CustomAction Id="EnumeratesqlServers"
                      BinaryKey="WebAppCA"
                      DllEntry="EnumeratesqlServers"
                      Execute="immediate"
                      Return="check" />

        <CustomAction Id="VerifysqlConnection"
              BinaryKey="WebAppCA"
              DllEntry="VerifysqlConnection"
              Execute="immediate"
              Return="check" />

         <!--Make sure the enumerate web sites and app pools custom action gets 
        called,but only called if we are doing and install.--> 
        <InstallUISequence>
            <Custom Action="EnumeratesqlServers"
                    After="CostFinalize"
                    Overridable="yes">NOT Installed</Custom>
        </InstallUISequence>


        <!-- MyWeb UI -->
        <UI Id="MyWebUI">

            <UIRef Id="WixUI_FeatureTree" />
            <UIRef Id="WixUI_ErrorProgresstext" />

            <!-- Injection of custom UI. -->
            <Publish Dialog="LicenseAgreementDlg" Control="Next" Event="NewDialog" Value="DatabaseinformationDlg">LicenseAccepted = "1"</Publish>            
        </UI>

    </Fragment>
</Wix>

UIDialogs.wxs:

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Fragment>
        <UI>
            <!--Define the dialog to get the Server and Database name information from the user-->
            <Dialog Id="DatabaseinformationDlg" Width="370" Height="270" Title="[ProductName] [Setup]" NoMinimize="yes">

                <Control Id="ServerLabel" Type="Text" X="20" Y="62" Width="80" Height="25" noprefix="yes" Text="sql Database:" />
                <Control Id="Server" Type="ComboBox" Height="16" Width="180" X="110" Y="60" Property="DATABASE_SERVER">
                    <ComboBox Property="DATABASE_SERVER">
                        <ListItem Text="[DATABASE_SERVER]" Value="[DATABASE_SERVER]" />
                    </ComboBox>
                    <Publish Property="logoN_VALID" Value="0">1</Publish>
                </Control>

                <Control Id="DatabaseType" Type="RadioButtonGroup" X="20" Y="100" Width="290" Height="40" Property="DATABASE_logoN_TYPE">
                    <RadioButtonGroup Property="DATABASE_logoN_TYPE">
                        <RadioButton Value="DatabaseIntegratedAuth" X="0" Y="0" Width="290" Height="16" Text="Trusted (Windows Authentication)" />
                        <RadioButton Value="DatabaseAccount" X="0" Y="20" Width="290" Height="16" Text="Specify Username and Password (sql Authentication)" />
                    </RadioButtonGroup>
                </Control>


                <!-- Login -->
                <Control Type="Text" Id="UsernameLabel" Width="50" Height="15" X="40" Y="150" Text="&amp;Login:">
                    <Condition Action="disable"><![CDATA[DATABASE_logoN_TYPE <> "DatabaseAccount"]]></Condition>
                    <Condition Action="enable"><![CDATA[DATABASE_logoN_TYPE = "DatabaseAccount"]]></Condition>
                </Control>
                <Control Id="Username" Type="Edit" X="110" Y="145" Width="180" Height="18" Property="DATABASE_USERNAME" Text="{80}">
                    <Condition Action="disable"><![CDATA[DATABASE_logoN_TYPE <> "DatabaseAccount"]]></Condition>
                    <Condition Action="enable"><![CDATA[DATABASE_logoN_TYPE = "DatabaseAccount"]]></Condition>
                    <Publish Property="logoN_VALID" Value="0">1</Publish>
                </Control>

                <!-- Password -->
                <Control Type="Text" Id="PasswordLabel" Width="50" Height="15" X="40" Y="173" Text="&amp;Password:">
                    <Condition Action="disable"><![CDATA[DATABASE_logoN_TYPE <> "DatabaseAccount"]]></Condition>
                    <Condition Action="enable"><![CDATA[DATABASE_logoN_TYPE = "DatabaseAccount"]]></Condition>
                </Control>
                <Control Id="Password" Type="Edit" X="110" Y="170" Width="180" Height="18" Property="DATABASE_PASSWORD" Text="{80}" Password="yes" >
                    <Condition Action="disable"><![CDATA[DATABASE_logoN_TYPE <> "DatabaseAccount"]]></Condition>
                    <Condition Action="enable"><![CDATA[DATABASE_logoN_TYPE = "DatabaseAccount"]]></Condition>
                </Control>

                <Control Id="Test" Type="PushButton" X="40" Y="197" Width="100" Height="17" Text="Test Connection">
                    <Condition Action="disable"><![CDATA[DATABASE_SERVER = ""]]></Condition>
                    <Condition Action="enable"><![CDATA[DATABASE_SERVER <> ""]]></Condition>
                     <!--test connection--> 
                    <Publish Property="ODBC_SERVER" Value="[DATABASE_SERVER]" Order="1">1</Publish>
                    <Publish Property="ODBC_SERVER" Value="[ComputerName]" Order="1"><![CDATA[DATABASE_SERVER = "(local)"]]></Publish>
                    <Publish Property="ODBC_CONNECTION_STRING" Value="Driver=sql Server;Server=[ODBC_SERVER],1433;Uid=[DATABASE_USERNAME];Pwd=[DATABASE_PASSWORD]" Order="2">1</Publish>
                    <Publish Event="DoAction" Value="VerifysqlConnection" Order="3">1</Publish>
                    <Publish Property="logoN_VALID" Value="1" Order="4"><![CDATA[ODBC_CONNECTION_ESTABLISHED]]></Publish>
                    <Publish Property="logoN_VALID" Value="0" Order="4"><![CDATA[NOT ODBC_CONNECTION_ESTABLISHED]]></Publish>
                    <Publish Property="logoN_ERROR" Value="Unexpected Error" Order="4"><![CDATA[(NOT ODBC_CONNECTION_ESTABLISHED) AND (ODBC_ERROR = "")]]></Publish>
                    <Publish Property="logoN_ERROR" Value="[ODBC_ERROR]" Order="4"><![CDATA[NOT ODBC_CONNECTION_ESTABLISHED]]></Publish>
                    <Publish Event="SpawnDialog" Value="InvalidlogonDlg" Order="5"><![CDATA[NOT ODBC_CONNECTION_ESTABLISHED]]></Publish>
                </Control>
                <Control Id="TestResult_Success" Type="Bitmap" X="210" Y="10" Width="24" Height="24" Text="success_bmp">
                    <Condition Action="hide"><![CDATA[logoN_VALID <> 1]]></Condition>
                    <Condition Action="show"><![CDATA[logoN_VALID = 1]]></Condition>
                </Control>
                <Control Id="TestResult_Failure" Type="Bitmap" X="210" Y="10" Width="24" Height="24" Text="error_bmp">
                    <Condition Action="hide"><![CDATA[logoN_VALID = 1]]></Condition>
                    <Condition Action="show"><![CDATA[logoN_VALID <> 1]]></Condition>
                </Control>

                <!-- Back button -->
                <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="&amp;Back">
                    <Publish Event="NewDialog" Value="LicenseAgreementDlg">1</Publish>
                </Control>
                <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="&amp;Next">
                    <Publish Property="DATABASE_logoN_TYPE" Value="[DATABASE_logoN_TYPE]">1</Publish>
                    <Publish Property="DATABASE_SERVER" Value="[DATABASE_SERVER]">1</Publish>
                    <Publish Property="DATABASE_USERNAME" Value="[DATABASE_USERNAME]"><![CDATA[DATABASE_logoN_TYPE = "DatabaseAccount"]]></Publish>
                    <Publish Property="DATABASE_PASSWORD" Value="[DATABASE_PASSWORD]"><![CDATA[DATABASE_logoN_TYPE = "DatabaseAccount"]]></Publish>
                    <Publish Property="DATABASE_USERNAME"><![CDATA[DATABASE_logoN_TYPE <> "DatabaseAccount"]]></Publish>
                    <Publish Property="DATABASE_PASSWORD"><![CDATA[DATABASE_logoN_TYPE <> "DatabaseAccount"]]></Publish>

                    <Publish Property="USEINTEGRATEDSecurity" Value="0"><![CDATA[DATABASE_logoN_TYPE = "DatabaseAccount"]]></Publish>
                    <Publish Property="USEINTEGRATEDSecurity" Value="1"><![CDATA[DATABASE_logoN_TYPE <> "DatabaseAccount"]]></Publish>

                    <Condition Action="disable"><![CDATA[logoN_VALID <> 1]]></Condition>
                    <Condition Action="enable"><![CDATA[logoN_VALID = 1]]></Condition>
                    <Publish Event="NewDialog" Value="DatabaseNameDlg">1</Publish>
                </Control>

                <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>

                <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="WixUI_Bmp_Banner" />
                <Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" noprefix="yes">
                    <Text>Please enter a sql instance and database name.</Text>
                </Control>
                <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
                <Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" noprefix="yes">
                    <Text>{\WixUI_Font_Title}sql instance and database information.</Text>
                </Control>
                <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
            </Dialog>

            <!-- INVALIDE sql LOGIN -->
            <Dialog Id="InvalidlogonDlg" Width="260" Height="105" Title="Invalid logon">
                <Control Id="Return" Type="PushButton" X="102" Y="77" Width="56" Height="17" Default="yes" Cancel="yes" Text="OK">
                    <Publish Event="EndDialog" Value="Return">1</Publish>
                </Control>
                <Control Id="Text" Type="Text" X="48" Y="15" Width="194" Height="50" Text="[ODBC_ERROR]" />
                <Control Id="Icon" Type="Icon" X="15" Y="15" Width="24" Height="24" FixedSize="yes" IconSize="32" Text="WixUI_Ico_Exclam" />
            </Dialog>

            <!-- DATABASE NAME -->
            <Dialog Id="DatabaseNameDlg" Width="370" Height="270" Title="[ProductName] [Setup]" NoMinimize="yes">
                <!-- Connection String -->
                <Control Id="DatabaseStringLabel" Type="Text" X="45" Y="73" Width="100" Height="15" TabSkip="no" Text="Database name:" />
                <Control Id="DatabaseStringEdit" Type="Edit" X="45" Y="90" Width="220" Height="18" Property="DATABASE_NAME" Text="{100}" />

                <Control Id="DatabaseStringLabel123" Type="Text" X="45" Y="120" Width="100" Height="15" TabSkip="no" Text="Use Win: [USEINTEGRATEDSecurity]--" />

                <!-- Back button -->
                <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="&amp;Back">
                    <Publish Event="NewDialog" Value="DatabaseinformationDlg">1</Publish>
                </Control>
                <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="&amp;Next">
                    <Publish Event="NewDialog" Value="CustomizeDlg">
                        <!--if settings are correct,allow next dialog-->
                        <![CDATA[DATABASE_NAME <> ""]]>
                    </Publish>
                </Control>
                <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>
                <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="WixUI_Bmp_Banner" />
                <Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" noprefix="yes">
                    <Text>Please enter database configuration</Text>
                </Control>
                <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
                <Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" noprefix="yes">
                    <Text>{\WixUI_Font_Title}Database Settings</Text>
                </Control>
                <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
            </Dialog>

        </UI>
    </Fragment>
</Wix>

OUTPUT:一个工作的db安装程序:

相关文章

SELECT a.*,b.dp_name,c.pa_name,fm_name=(CASE WHEN a.fm_n...
if not exists(select name from syscolumns where name=&am...
select a.*,pano=a.pa_no,b.pa_name,f.dp_name,e.fw_state_n...
要在 SQL Server 2019 中设置定时自动重启,可以使用 Window...
您收到的错误消息表明数据库 &#39;EastRiver&#39; 的...
首先我需要查询出需要使用SQL Server Profiler跟踪的数据库标...