wix复制文件错误

时间:2012-08-04 20:42:38

标签: wix wix3.5

我收到此错误:

  

未解决的对“目录:SQLSERVERDATAPATH”符号的引用   部分'产品:*

<Property Id="SQLSERVERINSTANCENAME" >
  <RegistrySearch Id="SqlServerInstanceName" Root="HKLM" Key="SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\SQL" Name="MSSQLSERVER" Type="raw"/>
</Property>

<Property Id="SQLSERVERDATAPATH" >
  <RegistrySearch Id="SqlServerDataPath" Root="HKLM" Key="SOFTWARE\Microsoft\Microsoft SQL Server\[SQLSERVERINSTANCENAME]\Setup" Name="SQLDataRoot" Type="raw"/>
</Property>

<DirectoryRef Id="SomeFolder">
      <Component Id="MDFFileCopyComponent" Guid="4A002555-D939-4DC9-8C23-62747C2BA905">
        <!--<RemoveFile Id="DatabaseFileRemove" Name="MyFile" On="install" Directory="MyCopyDir" />-->
        <CopyFile Id="MDFFileCopy" FileId="MDF" DestinationDirectory="SQLSERVERDATAPATH" />
      </Component>
      <Component Id="LDFFileCopyComponent" Guid="4A002555-D939-4DC9-8C23-62747C2BA905">
        <!--<RemoveFile Id="DatabaseFileRemove" Name="MyFile" On="install" Directory="MyCopyDir" />-->
        <CopyFile Id="LDFFileCopy" FileId="LDF" DestinationDirectory="SQLSERVERDATAPATH" />
      </Component>
</DirectoryRef>

更新

<DirectoryRef Id="SomeFolder">
  <Component Id="cmpMDF" Guid="066AFD32-D9B4-42A9-AEE1-F1951DAE959F">
    <File Id="MDF" Name="Database.MDF" Source="DatabaseScripts/Database/Database.MDF" KeyPath="yes" ReadOnly="no">
      <CopyFile Id="MDFFileCopy" DestinationProperty="SQLSERVERDATAPATH" />
    </File>
  </Component>
  <Component Id="cmpLDF" Guid="311283B0-A6E8-402D-BB33-D1BEB6EA282B">
    <File Id="LDF" Name="Database.LDF" Source="DatabaseScripts/Database/Database.LDF" KeyPath="yes" ReadOnly="no">
      <CopyFile Id="LDFFileCopy" DestinationProperty="SQLSERVERDATAPATH" />
    </File>
  </Component>
</DirectoryRef>

日志:

MSI(s)(18:BC)[13:42:32:002]:执行op:FileCopy(SourceName = Database.MDF,SourceCabKey = MDF,DestName = Database.MDF,Attributes = 512,FileSize = 1178468352 ,PerTick = 32768,VerifyMedia = 1 ,,,,, CheckCRC = 0 ,,, INSTALLMODE = 58982400,HashOptions = 0,HashPart1 = -67171634,HashPart2 = 622189464,HashPart3 = -328220288,HashPart4 = -1777642375 ,,)< / p>

MSI(18:BC)[13:42:32:006]:文件:C:\ Program Files \ MyApp \ Database \ Database.MDF;待安装;不会补丁;没有现有文件

MSI(s)(18:BC)[13:42:32:009]:压缩文件'MDF'的源 InstallFiles:File:Database.MDF,Directory:C:\ Program Files \ MyApp \ Database \,Size:1178468352

MSI(18:BC)[13:42:32:015]:注意:1:2318 2:C:\ Program Files \ MyApp \ Database \ Database.MDF

MSI(18:BC)[13:42:32:034]:注:1:2360

1 个答案:

答案 0 :(得分:1)

在您的<CopyFile>中加入DestinationDirectory="SQLSERVERDATAPATH" 这意味着您必须在某处拥有<Directory> id="SQLSERVERDATAPATH"

修改:您似乎想要使用DestinationProperty="SQLSERVERDATAPATH"。 见http://wix.sourceforge.net/manual-wix2/wix_xsd_copyfile.htm