WiX补丁创建出错

时间:2017-11-14 13:18:14

标签: wix patch pyro

我在Visual Studio 2017中创建了一个WiX项目,其中包含CustomDialog,变量文件,本地化文件和具有以下结构的Product.wxs。在项目中,我添加了两个dll引用(WixUIExtension和WixUtilExtension)。我有4个文件夹添加到项目中。

二进制,1.0.0,1.0.1和本地化。

以下是文件夹内的内容。

二进制文件夹包含Sample.ico,TestWinSvc.exe TestWinSvc.exe.config文件。

1.0.0文件夹包含Manual.pdf和Sample.txt文件

1.0.1文件夹有Sample.txt(其内容与1.0.0中的内容不同)

本地化文件夹有en-us.wxl

en-us.wxl的内容如下。

    <?xml version="1.0" encoding="utf-8"?>
    <WixLocalization Culture="en-us" 
    xmlns="http://schemas.microsoft.com/wix/2006/localization">
        <String Id="LANG">1033</String>
      <String Id="ProductName">Sample MSI Product(EN-US)</String>
      <String Id="InstallFolderName">MSI Sample(EN-US)</String>
    </WixLocalization>

该项目还有以下文件。

License.rtf(示例许可证文件)Product.wxs ServiceAccountDlg.wxs Variables.wxi

以下是每个文件的内容。

Product.wxs具有以下代码

  <?xml version="1.0" encoding="UTF-8"?>
  <?include Variables.wxi ?>    
  <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" 
  xmlns:util='http://schemas.microsoft.com/wix/UtilExtension'>
  <Product Id="$(var.ProductCode)" Name="$(var.ProductName)" Language="!
  (loc.LANG)" Version="$(var.ProductVersion)" Manufacturer="MyCompany" 
  UpgradeCode="$(var.UpgradeCode)">    
    <Package InstallerVersion="200" Compressed="yes" 
     InstallScope="perMachine" />    
    <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is 
    already installed." />    
    <Condition Message='This application only runs on Windows 7 or higher OS 
    versions.'>
      <![CDATA[Installed OR (VersionNT64 >= 601)]]>
    </Condition>    
    <MediaTemplate />    
    <Property Id="MSIFASTINSTALL" Value="1"/>
    <Property Id="MsiLogging" Value="v" />
    <Property Id="INSTALLDIR">
      <RegistrySearch Id='MSISampleRegistry' Type='raw' Root='HKLM' 
      Key='SOFTWARE\MyCompany\App' Name='INSTALLDIR' Win64='yes' />
    </Property>    
     <WixVariable Id="WixUILicenseRtf" Value="License.rtf" />    
     <Feature Id='Complete' Title='Foobar 1.0' Description='The complete 
    package.'
    Display='expand' Level='1' ConfigurableDirectory='INSTALLDIR' 
    AllowAdvertise='no' InstallDefault='local' Absent='disallow'>
      <Feature Id="ProductFeature" Title="SampleMSI" Level="1" 
    AllowAdvertise='no' InstallDefault='local' Absent='disallow' 
    Display='expand'>
        <ComponentRef Id="ProductComponent"/>
        <ComponentRef Id="ServiceComponent"/>
        <ComponentRef Id="RegistryComponent"/>
        <ComponentRef Id="deleteFolder"/>
      </Feature>    
      <Feature Id='Documentation' Title='Description' Description='The 
       instruction manual.' Level='2' AllowAdvertise='no' 
       InstallDefault='followParent' Absent='disallow'>
        <ComponentRef Id='Manual' />
      </Feature>    
     </Feature>    
     <!--<UIRef Id="WixUI_Mondo"/>
     <UIRef Id="WixUI_ErrorProgressText" />-->    
     <UI Id="MyWixUI_Mondo">
      <UIRef Id="WixUI_Mondo" />    
      <DialogRef Id="ServiceAccountDlg" />    
      <Publish Dialog="LicenseAgreementDlg" Control="Next" Event="NewDialog" 
      Value="ServiceAccountDlg" Order="2">LicenseAccepted = "1"</Publish>
      <Publish Dialog="SetupTypeDlg" Control="Back" Event="NewDialog" 
      Value="ServiceAccountDlg">1</Publish>
      </UI>
      <UIRef Id="WixUI_ErrorProgressText" />    
      <Icon Id="Sample.ico" SourceFile="Binary\Sample.ico" />
     </Product>    
    <Fragment>
    <Component Id='Manual' Guid='7470A2CD-B07C-4AB4-9152-8C6AA53FA0F7' 
    Directory='INSTALLDIR'>
      <File Id='Manual' Name='Manual.pdf' DiskId='1' 
    Source='$(var.ProductVersion)\Manual.pdf' KeyPath='yes'>
        <Shortcut Id="startmenuManual" Directory="DesktopFolder" 
     Name="Instruction Manual" Advertise="yes" />
      </File>
    </Component>
    </Fragment>    
    <Fragment>
    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="ProgramFilesFolder">
        <Directory Id="INSTALLDIR" Name="$(var.InstallFolderName)" />
      </Directory>
      <Directory Id="DesktopFolder" Name="Desktop" />
      <Directory Id="CommonAppDataFolder">
        <Directory Id="TestInstallerLogs" Name="TestInstallerLogs">
          <Component Id="deleteFolder" Guid="323549D2-90B7-4D5D-8A36-
        EEA0ACCCC35E">
            <RemoveFile Id="deleteServiceFile" Name="TestWinSvcLog.txt" 
           On="both" Directory="TestInstallerLogs"/>
            <RemoveFolder Directory="TestInstallerLogs" 
         Id="TestInstallerLogs" On="both"/>
          </Component>
        </Directory>
        </Directory>
        </Directory>
        </Fragment>    
       <Fragment>
      <Component Id="ProductComponent" Directory="INSTALLDIR">      
      <File Id="SampleTextFile.txt" Name="Sample.txt" 
      Source="$(var.ProductVersion)\Sample.txt" KeyPath="yes">
        <Shortcut Id="startmenuSampleText" Directory="DesktopFolder" 
      Name="MSI Sample" WorkingDirectory='INSTALLDIR' Icon='Sample.ico' 
      Advertise='yes' />
      </File>
      </Component>
      </Fragment>    
      <Fragment>
      <Component Id='ServiceComponent' Directory="INSTALLDIR">
      <util:User Domain="[DOMAIN]" Id="svcUser" Name="[USER_NAME]" 
      Password="[PASSWORD]" LogonAsService="yes"/>
      <File Id='testWinSvc' Name='TestWinSvc.exe' 
      Source='Binary\TestWinSvc.exe' KeyPath='yes' />
      <ServiceInstall Id="installTestWinSvc" Name="TestWinSvc" 
      DisplayName="Install Test Windows Service" Start="auto" 
      ErrorControl="normal" Type="ownProcess" Account="[DOMAIN]\[USER_NAME]" 
      Password="[PASSWORD]" />
      <ServiceControl Id="sc_TestWinSvc" Name="TestWinSvc" Start="install" 
      Stop="both" Remove="uninstall" Wait="yes" />
      <ServiceControl Id="stopAndStartIIS" Name="IISADMIN" Start="uninstall" 
       Stop="install" Wait="yes" />
      <ServiceControl Id="stopAndStartSQL" Name="MSSQLSERVER" 
      Start="uninstall" Stop="install" Wait="yes" />
      </Component>
      </Fragment>    
      <Fragment>
      <Component Id="RegistryComponent" Directory="INSTALLDIR">
      <RegistryValue Root='HKCU' Key='Software\[Manufacturer]\[ProductName]' 
      Type='string' Value='' KeyPath='yes' />
      </Component>
      </Fragment>    
      </Wix>

ServiceAccountDlg.wxs具有以下代码

      <?xml version="1.0" encoding="UTF-8"?>
      <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
        <Fragment>
        <UI>
         <Dialog Id="ServiceAccountDlg" Title="Service Account Credentials" 
           Width="370" Height="270" NoMinimize="yes">
         <Control Id="lblDomain" Type="Text" X="45" Y="35" Width="100" 
          Height="15" TabSkip="no" Text="&amp;Domain:" />
         <Control Id="txtDomain" Type="Edit" X="45" Y="50" Width="220" 
         Height="18" Property="DOMAIN" Text="{80}" />
         <Control Id="lblUserName" Type="Text" X="45" Y="73" Width="100" 
          Height="15" TabSkip="no" Text="&amp;User Name:" />
          <Control Id="txtUserName" Type="Edit" X="45" Y="85" Width="220" 
           Height="18" Property="USER_NAME" Text="{80}" />
          <Control Id="lblPassword" Type="Text" X="45" Y="110" Width="100" 
           Height="15" TabSkip="no" Text="&amp;Password:" />
          <Control Id="txtPassword" Type="Edit" Password="yes" X="45" 
          Y="122" Width="220" Height="18" Property="PASSWORD" Text="{80}" />
            <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 Event="SpawnWaitDialog" 
           Value="WaitForCostingDlg">CostingComplete = 1</Publish>
          <Publish Event="NewDialog" Value="SetupTypeDlg"></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>
          </Dialog>
          </UI>
          </Fragment>
          </Wix>

Variables.wxi具有以下代码。

          <?xml version="1.0" encoding="utf-8"?>
          <Include>
          <?define ProductCode = "21080224-9B1A-46D7-8560-2760B8E429DD" ?>
          <?define UpgradeCode = "BFF39007-24DC-4F27-AF79-A3D99DC58FB9" ?>
            <?define ProductName = "!(loc.ProductName)" ?>
          <?define InstallFolderName = "!(loc.InstallFolderName)" ?>
           <?define ProductVersion = "1.0.0" ?>
          <?define ProductURL = "http://mycompany.com/products/1/" ?>
          <?define BinaryDirectory = "$(var.ProjectDir)\Binary" ?>
          </Include>

我还有一个包含以下内容的Patch.wxs文件。该文件位于项目目录之外。

Patch.wxs有以下代码。

          <?xml version="1.0" encoding="UTF-8"?>
          <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
          <Patch 
            AllowRemoval="yes"
            Manufacturer="MyCompany" 
            MoreInfoURL="https://www.mycompany.com/"
            DisplayName="Test Patch" 
            Description="Test Update Patch" 
            Classification="Update"
            >                
            <Media Id="5000" Cabinet="RTM.cab">
                <PatchBaseline Id="RTM"/>
            </Media>
            <PatchFamilyRef Id="TestPatchFamily"/>
            </Patch>
            <Fragment>    
            <PatchFamily Id='TestPatchFamily' Version='1.0.0' 
             Supersede='yes'>
                <ComponentRef Id="ProductComponent"/>
            </PatchFamily>
            </Fragment>
            </Wix>

由于Visual Studio似乎没有为Patch创建提供良好的支持,因此我使用命令提示符来生成转换和MSP文件。我在Visual Studio中使用该项目主要是因为它在除了Patch创建之外的大多数其他场景中都非常有用。

在命令提示符中(我已在环境变量中添加了WixToolSet位置),我导航到Project目录并执行以下命令。

candle.exe -ext WiXUtilExtension -dProjectDir =“D:\ Projects \ WiX \ SampleMSI”-dVersion = 1.0.0 * .wxs -out 1.0.0 \ light.exe -ext WixUIExtension -ext WiXUtilExtension - sval 1.0.0 * .wixobj -cultures:en-us -loc Localization \ en-us.wxl -xo -out 1.0.0 \ OldSampleMSI.wixout

candle.exe -ext WiXUtilExtension -dProjectDir =“D:\ Projects \ WiX \ SampleMSI”-dVersion = 1.0.1 * .wxs -out 1.0.1 \ light.exe -ext WixUIExtension -ext WiXUtilExtension - sval 1.0.1 * .wixobj -cultures:en-us -loc Localization \ en-us.wxl -xo -out 1.0.1 \ NewSampleMSI.wixout torch.exe -p -xi 1.0.0 \ OldSampleMSI.wixout 1.0.1 \ NewSampleMSI.wixout -out Patch \ Diff.Wixmst

candle.exe D:\ MyProjects \ WIX \ Patch.wxs -out Patch \ light.exe Patch \ Patch.wixobj -out Patch \ Patch.WixMsp pyro.exe Patch \ Patch.WixMsp -out Patch \ Patch.msp -t RTM Patch \ Diff.wixmst

Pyro命令发出警告和错误。我不确定缺少什么或不正确。有人可以帮忙吗?

警告(在Patch.wxs中): PYRO1079:机柜RTM.cab不包含任何文件。如果此修补程序不包含任何文件,则可能会安全地忽略此警告。否则,尝试在首次构建转换时将-p传递给torch.exe,或者在PatchFamily创作中添加ComponentRef以将更改的文件拉入文件柜

错误(在wixmst中): PYRO0227:正在构建的转换没有任何差异,因此无法创建

有人可以帮助我吗?

0 个答案:

没有答案