2013-02-07 24 views
3

Wix显然可以提示/告诉用户数据库存在,并给他们选择覆盖或取消安装。不幸的是,用户不能指定'不覆盖'并继续进行安装。Wix可以静默不覆盖数据库

因此,Wix可以默默不覆盖数据库吗?如果数据库存在,则忽略并继续下一条指令。

如果没有,是否有另一种方法来实现重新安装需要发生并且数据库已经到位的事实?

目前我维克斯片段看起来是这样的:

<Fragment> 
    <ComponentGroup Id="COMPG_MyProductDatabase" Directory="TARGETDIR"> 
     <Component Id="COMPG_MyProductDatabase.sql" Guid="{...}"> 
     <File Id="FILE_MyProductDatabase.sql" Source="..\MyProduct.Cache.Database\MyProduct.Deployment.sql" Name="MyProduct.Deployment.sql" KeyPath="yes" Checksum="yes"/> 
     </Component> 

     <Component Id='COMP_MyProductDatabase' Guid='{...}'> 
     <CreateFolder/> 
     <sql:SqlDatabase Id='DB_MyProductDatabase' Database='MyProduct' Server='[PROP_DATABASESERVERNAME]' 
      CreateOnInstall='yes' DropOnUninstall='no' ContinueOnError='yes' ConfirmOverwrite='yes'> 
      <sql:SqlScript Id='SQL_MyProductDatabase' BinaryKey='FILE_MyProductDatabase' ExecuteOnInstall='yes' /> 
     </sql:SqlDatabase> 
     </Component> 
    </ComponentGroup> 
    <Binary Id='FILE_MyProductDatabase' SourceFile='..\MyProduct.Cache.Database\MyProduct.Deployment.sql' /> 
</Fragment> 

回答

2

移动数据库创建到SQL脚本,然后使用SQL语句来执行条件逻辑。将SqlDatabase元素更改为连接到'master'以使其工作。