代码之家  ›  专栏  ›  技术社区  ›  Andrew Matthews

使用MSI/WIX 3.5的数据库权限问题

  •  0
  • Andrew Matthews  · 技术社区  · 14 年前

    <?xml version="1.0" encoding="UTF-8"?>
    <Wix xmlns='http://schemas.microsoft.com/wix/2006/wi' 
         xmlns:util='http://schemas.microsoft.com/wix/UtilExtension' 
         xmlns:sql='http://schemas.microsoft.com/wix/SqlExtension'>
    
      <?include $(sys.CURRENTDIR)\Config.wxi?>
      <?include ..\Common.wxi?>
    
      <Product Name='Agent Desktop $(var.SVCNAME)-$(var.ProductVersion)-$(var.BranchName)' Id='*' UpgradeCode='$(var.UpgradeCode)'
        Language='1033' Codepage='1252' Version='$(var.ProductVersion)' Manufacturer='$(var.ProductManufacturer)'>
    
        <Package Id='*'
                 Keywords='Installer'
                 Description="$(var.ProductManufacturer) $(var.SVCNAME)-$(var.ProductVersion)-$(var.BranchName) Installer"
                 Comments='Premier Contact Point and PCP are registered trademarks of $(var.ProductManufacturer)'
                 Manufacturer='$(var.ProductManufacturer)'
                 InstallerVersion='100'
                 Languages='1033'
                 Compressed='yes'
                 SummaryCodepage='1252' />
    
        <Upgrade Id="$(var.UpgradeCode)">
          <UpgradeVersion
              Minimum="1.0.0.0" Maximum="99.0.0.0"
              Property="PREVIOUSVERSIONSINSTALLED"
              IncludeMinimum="yes" IncludeMaximum="no" />
    
        </Upgrade>
        <InstallExecuteSequence>
          <RemoveExistingProducts Before="InstallInitialize" />
        </InstallExecuteSequence>
    
    
        <Media Id='1' Cabinet='Sample.cab' EmbedCab='yes' DiskPrompt="CD-ROM #1" />
        <Property Id='DiskPrompt' Value="Premier Contact Point $(var.DBNAME)-$(var.ProductVersion)-$(var.BranchName) Installer [1]" />
    
            <Directory Id="TARGETDIR" Name="SourceDir">
                <Directory Id="ProgramFilesFolder">
            <Directory Id="PremierTechnologies" Name="$(var.ProductManufacturer)">
                      <Directory Id="INSTALLLOCATION" Name="PCP $(var.DBNAME)-$(var.ProductVersion)-$(var.BranchName)">
    
                <Component Id='SqlComponent' Guid='YOUR-GUID-HERE'>
                  <sql:SqlDatabase Id='SqlDatabase' Database='$(var.DBNAME)-$(var.ProductVersion)-$(var.BranchName)' 
                                   Server='$(var.DbServer)' CreateOnInstall='yes' DropOnUninstall='yes' ConfirmOverwrite='no' ContinueOnError='no'>
    
                    <sql:SqlScript Id='Script0001' Sequence='01' BinaryKey='Script0001' ExecuteOnInstall='yes' />
    
                  </sql:SqlDatabase>
    
                </Component>
              </Directory>
    
            </Directory>
                </Directory>
            </Directory>
    
        <Binary Id='Script0001' SourceFile='../../DatabaseUpdater/UpgradeScripts/Script0001.sql' />
    
        <Feature Id='SqlFeature' Title='SqlFeature' Level="1">
          <ComponentRef Id='SqlComponent' />
        </Feature>
    
      </Product>
    </Wix>
    

    它使用(local)/SQLEXPRESS在我的本地机器上安装OK,但是当我尝试使用'.'或'(local)'将它安装到SQL std机器上,使用Windows身份验证时,我会遇到可怕的问题 Error 26201. failed to create SQL database 错误。

    我从powershell脚本调用了MSI,如下所示:

    start-process "msiexec.exe" "/i Database.msi /l*v Database-install.log" -wait
    

    MSI (s) (E4:70) [11:54:27:897]: Note: 1: 1402 2: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Installer\Rollback\Scripts 3: 2 
    MSI (s) (E4:70) [11:54:27:897]: Executing op: Header(Signature=1397708873,Version=405,Timestamp=1025466054,LangId=1033,Platform=0,ScriptType=1,ScriptMajorVersion=21,ScriptMinorVersion=4,ScriptAttributes=0)
    MSI (s) (E4:70) [11:54:27:897]: Executing op: ProductInfo(ProductKey={59CBDFC0-F16D-492D-A46B-336421D7F2F2},ProductName=Agent Desktop DB-3.9.9.0-wix,PackageName=Database.msi,Language=1033,Version=50921481,Assignment=0,ObsoleteArg=0,,,PackageCode={A3E3E186-D9AF-46B9-90D8-8FB6217AC71F},,,InstanceType=0,LUASetting=0,RemoteURTInstalls=0,ProductDeploymentFlags=3)
    MSI (s) (E4:70) [11:54:27:897]: SHELL32::SHGetFolderPath returned: C:\Documents and Settings\andrewm.PCPDEV\Application Data
    MSI (s) (E4:70) [11:54:27:897]: Executing op: DialogInfo(Type=0,Argument=1033)
    MSI (s) (E4:70) [11:54:27:897]: Executing op: DialogInfo(Type=1,Argument=Agent Desktop DB-3.9.9.0-wix)
    MSI (s) (E4:70) [11:54:27:897]: Executing op: RollbackInfo(,RollbackAction=Rollback,RollbackDescription=Rolling back action:,RollbackTemplate=[1],CleanupAction=RollbackCleanup,CleanupDescription=Removing backup files,CleanupTemplate=File: [1])
    MSI (s) (E4:70) [11:54:27:897]: Executing op: SetBaseline(Baseline=0,)
    MSI (s) (E4:70) [11:54:27:897]: Executing op: SetBaseline(Baseline=1,)
    MSI (s) (E4:70) [11:54:27:897]: Executing op: ActionStart(Name=ProcessComponents,Description=Updating component registration,)
    MSI (s) (E4:70) [11:54:27:897]: Executing op: ProgressTotal(Total=1,Type=1,ByteEquivalent=24000)
    MSI (s) (E4:70) [11:54:27:897]: Executing op: ComponentRegister(ComponentId={A53B47BD-FFCD-4A7B-BF6D-E5356B0AD76A},KeyPath=C:\Program Files\Premier Technologies\PCP AgentDesktop-3.9.9.0-wix\,State=3,,Disk=1,SharedDllRefCount=0,BinaryType=0)
    MSI (s) (E4:70) [11:54:27:913]: Executing op: ActionStart(Name=InstallFiles,Description=Copying new files,Template=File: [1],  Directory: [9],  Size: [6])
    MSI (s) (E4:70) [11:54:27:913]: Executing op: InstallProtectedFiles(AllowUI=1)
    MSI (s) (E4:70) [11:54:27:913]: Executing op: ActionStart(Name=CreateDatabase,Description=Creating Databases,)
    MSI (s) (E4:70) [11:54:27:913]: Executing op: CustomActionSchedule(Action=CreateDatabase,ActionType=25601,Source=BinaryData,Target=**********,CustomActionData=**********)
    MSI (s) (E4:60) [11:54:27:913]: Invoking remote custom action. DLL: C:\WINDOWS\Installer\MSID7.tmp, Entrypoint: CreateDatabase
    CreateDatabase:  Error 0x80004005: failed to create to database: 'AgentDesktop-3.9.9.0-wix', error: unknown error
    MSI (c) (CC:08) [11:54:44:584]: Font created.  Charset: Req=0, Ret=0, Font: Req=MS Shell Dlg, Ret=MS Shell Dlg
    
    Error 26201. Error -2147467259: failed to create SQL database: AgentDesktop-3.9.9.0-wix, error detail: unknown error.
    MSI (s) (E4!6C) [11:54:46:444]: Product: Agent Desktop DB-3.9.9.0-wix -- Error 26201. Error -2147467259: failed to create SQL database: AgentDesktop-3.9.9.0-wix, error detail: unknown error.
    
    Action ended 11:54:46: InstallFinalize. Return value 3.
    MSI (s) (E4:70) [11:54:46:459]: User policy value 'DisableRollback' is 0
    MSI (s) (E4:70) [11:54:46:459]: Machine policy value 'DisableRollback' is 0
    MSI (s) (E4:70) [11:54:46:475]: Executing op: Header(Signature=1397708873,Version=405,Timestamp=1025466062,LangId=1033,Platform=0,ScriptType=2,ScriptMajorVersion=21,ScriptMinorVersion=4,ScriptAttributes=0)
    MSI (s) (E4:70) [11:54:46:475]: Executing op: DialogInfo(Type=0,Argument=1033)
    MSI (s) (E4:70) [11:54:46:475]: Executing op: DialogInfo(Type=1,Argument=Agent Desktop DB-3.9.9.0-wix)
    MSI (s) (E4:70) [11:54:46:475]: Executing op: RollbackInfo(,RollbackAction=Rollback,RollbackDescription=Rolling back action:,RollbackTemplate=[1],CleanupAction=RollbackCleanup,CleanupDescription=Removing backup files,CleanupTemplate=File: [1])
    MSI (s) (E4:70) [11:54:46:475]: Executing op: ActionStart(Name=CreateDatabase,Description=Creating Databases,)
    MSI (s) (E4:70) [11:54:46:475]: Executing op: ProductInfo(ProductKey={59CBDFC0-F16D-492D-A46B-336421D7F2F2},ProductName=Agent Desktop DB-3.9.9.0-wix,PackageName=Database.msi,Language=1033,Version=50921481,Assignment=0,ObsoleteArg=0,,,PackageCode={A3E3E186-D9AF-46B9-90D8-8FB6217AC71F},,,InstanceType=0,LUASetting=0,RemoteURTInstalls=0,ProductDeploymentFlags=3)
    MSI (s) (E4:70) [11:54:46:491]: SHELL32::SHGetFolderPath returned: C:\Documents and Settings\andrewm.PCPDEV\Application Data
    MSI (s) (E4:70) [11:54:46:491]: Executing op: ActionStart(Name=InstallFiles,Description=Copying new files,Template=File: [1],  Directory: [9],  Size: [6])
    MSI (s) (E4:70) [11:54:46:491]: Executing op: ActionStart(Name=ProcessComponents,Description=Updating component registration,)
    MSI (s) (E4:70) [11:54:46:491]: Executing op: ComponentUnregister(ComponentId={A53B47BD-FFCD-4A7B-BF6D-E5356B0AD76A},ProductKey={59CBDFC0-F16D-492D-A46B-336421D7F2F2},BinaryType=0,)
    MSI (s) (E4:70) [11:54:46:491]: Executing op: End(Checksum=0,ProgressTotalHDWord=0,ProgressTotalLDWord=0)
    MSI (s) (E4:70) [11:54:46:491]: Error in rollback skipped.  Return: 5
    MSI (s) (E4:70) [11:54:46:491]: No System Restore sequence number for this installation.
    MSI (s) (E4:70) [11:54:46:491]: Unlocking Server
    MSI (s) (E4:70) [11:54:46:491]: PROPERTY CHANGE: Deleting UpdateStarted property. Its current value is '1'.
    Action ended 11:54:46: INSTALL. Return value 3.
    Property(S): DiskPrompt = Premier Contact Point AgentDesktop-3.9.9.0-wix Installer [1]
    Property(S): UpgradeCode = {79DB4D69-D287-4441-8148-40E270729E21}
    Property(S): CreateDatabase = SqlDatabase?.??AgentDesktop-3.9.9.0-wix?3?1???0?0
    Property(S): ExecuteSqlStrings = SqlDatabase?.??AgentDesktop-3.9.9.0-wix?3?1???Script0001?1?create table dbo.SchemaVersions 
    

    我已经尝试了我能想到的一切,或者WIX论坛(和这里)中提到的,但是没有任何效果。我假设这个错误确实是权限问题,但是我使用的帐户在我试图安装到的数据库中具有sysadmin权限。

    你能想到,或者你听说过,WIX中的SqlDatabase安装程序CA会以这种方式失败吗?

    1 回复  |  直到 14 年前
        1
  •  2
  •   Rob Mensching    14 年前