包括 WSX 文件的片段

发布于 2024-08-20 07:22:04 字数 5184 浏览 2 评论 0原文

我将逻辑部分分离到片段 *.wxs 文件中,但如何使用 Votive 和 Visual Studio 将它们包含在我的主 Product.wxs 中?我在主 wxs 文件中引用该组件,但收到错误消息,提示找不到该组件。我假设我没有正确链接这些。

Error 13 Unresolved reference to symbol 'Component:RegistryEntries' in section 'Product:{A5CA93A2-91B2-46CA-B681-07451DCCCDCB}'.

<ComponentRef Id="RegistryEntries"/>

注册表设置.wxs

<?xml version="1.0" encoding="UTF-8" ?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<?include $(sys.CURRENTDIR)\Config.wxi?>

<!-- Registry entries -->
<Fragment Id="RegistrySettings">
<DirectoryRef Id="TARGETDIR">
  <Component Id="RegistryEntries" Guid="{MY-GUID}">

    <!-- Create registry keys and grant user rights -->
    <!-- Add Registry Keys and default values as necessary -->
    <RegistryKey Root="HKLM" Key="$(var.RegKey)" Action="create">
      <Permission User="$(var.DefaultUser)" GenericAll="yes" ChangePermission="yes"/>
    </RegistryKey>

    <!-- Connection Info registry keys and values -->
    <RegistryKey Root="HKLM" Key="$(var.ConnectionRegKey)" Action="create">
      <Permission User="$(var.DefaultUser)" GenericAll="yes" ChangePermission="yes" />

      <!-- Main Connection settings -->
      <RegistryValue Name="SoapURL" Value="$(var.DefaultSoapUrl)" Type="string"/>
    </RegistryKey>
    ...

  </Component>
</DirectoryRef>
</Fragment>
</Wix>

产品.wxs

<?xml version="1.0" encoding="UTF-8" ?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
 xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension">

<!-- Use pre-processor variable to include other wix variable definitions / components -->
<?include $(sys.CURRENTDIR)\Config.wxi?>

<Product Id="a5ca93a2-91b2-46ca-b681-07451dcccdcb" 
       Name="$(var.ProductName)" 
       Language="1033"
       Version="$(var.ProductVersion)" 
       Manufacturer="$(var.ProductManufacturer)" 
       UpgradeCode="$(var.UpgradeCode)">

<Package InstallerVersion="200" Compressed="yes" Keywords='Installer' Description="App Installer"
  Languages='1033' SummaryCodepage='1252' />

<!-- Define custom variables for icons and license files -->
<WixVariable Id="WixUILicenseRtf" Value="docs\liscensing.rtf" />
<WixVariable Id="WixUIBannerBmp" Value="images\fplogo1.bmp" />
<WixVariable Id="WixUIDialogBmp" Value="images\fp-setup.bmp" />

<!-- Add Install conditions such as .Net version required and privileges -->
<PropertyRef Id="NETFRAMEWORK35_SP_LEVEL"/>
<Condition Message="This application requires .NET Framework 3.5 SP1. Please install the .NET Framework then run this installer again.">
  <![CDATA[Installed OR (NETFRAMEWORK35_SP_LEVEL and NOT NETFRAMEWORK35_SP_LEVEL = "#0")]]>
</Condition>

<Condition Message="You need to be an administrator to install this product.">
  Privileged
</Condition>

<Media Id="1" Cabinet="My.cab" EmbedCab="yes" />

<!-- Default to installing for all users / everyone -->
<Property Id="ALLUSERS">1</Property>


<!-- Win64="$(var.Win64)" -->
<Property Id="INSTALLDIR">
  <RegistrySearch Id="RegistrySearch" Type="raw" Root="HKLM" 
            Key="Software\[Manufacturer]\[ProductName]" Name="InstallLocation" />
</Property>

<!-- Add Remove Programs properties -->
<Property Id="ARPPRODUCTICON" Value="MyIcon.exe" />
<Property Id="ARPHELPLINK" Value="$(var.ArpHelpUrl)" />

<!-- Base Install Directory  - Define Directory Structures -->
<Directory Id="TARGETDIR" Name="SourceDir">
  <Directory Id="ProgramFilesFolder">
    <Directory Id="APPLICATIONFOLDER" Name="MyWix">
      <Directory Id="ArchDir" Name="$(var.ArchDir)" />
      <Directory Id="LogDir" Name="$(var.LogDir)" />
      <Directory Id="TempDir" Name="$(var.TempDir)" />
    </Directory>
  </Directory>

  <Directory Id="ProgramMenuFolder" Name="Programs">
    <Directory Id="ApplicationProgramsDir" Name="MyWix" />
  </Directory>

  <Directory Id="DesktopFolder" Name="Desktop" />
</Directory>

<!-- Application Directory and Structure-->
<DirectoryRef Id="APPLICATIONFOLDER">
  <Component Id="My.exe" Guid="MYGUID">
    <File Id="My.exe.file" Name="$(var.Project.TargetFileName)"
          Source="$(var.Project.TargetPath)" DiskId="1" KeyPath="yes" Vital="yes">
    </File>
  </Component>
</DirectoryRef >



<!-- Features to install, these could include the main exe, help docs, and scanner components -->
<Feature Id="Complete" Title="Product" Description="The complete package"
         Display="expand" Level="1" ConfigurableDirectory="APPLICATIONFOLDER">
  <Feature Id="MainApplication" Title="Installer Wix" Level="1">
    <ComponentRef Id="My.exe"/>
    <ComponentRef Id="RegistryEntries"/>
    <ComponentRef Id="ApplicationStartMenuShortCut" />
  </Feature>
</Feature>
</Product> 
</Wix>

I am separating out logical sections into fragment *.wxs files, but how do I include them in my main Product.wxs using Votive and Visual Studio? I am referencing the component in the main wxs file but receive and error that the component is not found. I'm assuming I'm not linking these correctly.

Error 13 Unresolved reference to symbol 'Component:RegistryEntries' in section 'Product:{A5CA93A2-91B2-46CA-B681-07451DCCCDCB}'.

<ComponentRef Id="RegistryEntries"/>

RegistrySettings.wxs

<?xml version="1.0" encoding="UTF-8" ?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<?include $(sys.CURRENTDIR)\Config.wxi?>

<!-- Registry entries -->
<Fragment Id="RegistrySettings">
<DirectoryRef Id="TARGETDIR">
  <Component Id="RegistryEntries" Guid="{MY-GUID}">

    <!-- Create registry keys and grant user rights -->
    <!-- Add Registry Keys and default values as necessary -->
    <RegistryKey Root="HKLM" Key="$(var.RegKey)" Action="create">
      <Permission User="$(var.DefaultUser)" GenericAll="yes" ChangePermission="yes"/>
    </RegistryKey>

    <!-- Connection Info registry keys and values -->
    <RegistryKey Root="HKLM" Key="$(var.ConnectionRegKey)" Action="create">
      <Permission User="$(var.DefaultUser)" GenericAll="yes" ChangePermission="yes" />

      <!-- Main Connection settings -->
      <RegistryValue Name="SoapURL" Value="$(var.DefaultSoapUrl)" Type="string"/>
    </RegistryKey>
    ...

  </Component>
</DirectoryRef>
</Fragment>
</Wix>

Product.wxs

<?xml version="1.0" encoding="UTF-8" ?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
 xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension">

<!-- Use pre-processor variable to include other wix variable definitions / components -->
<?include $(sys.CURRENTDIR)\Config.wxi?>

<Product Id="a5ca93a2-91b2-46ca-b681-07451dcccdcb" 
       Name="$(var.ProductName)" 
       Language="1033"
       Version="$(var.ProductVersion)" 
       Manufacturer="$(var.ProductManufacturer)" 
       UpgradeCode="$(var.UpgradeCode)">

<Package InstallerVersion="200" Compressed="yes" Keywords='Installer' Description="App Installer"
  Languages='1033' SummaryCodepage='1252' />

<!-- Define custom variables for icons and license files -->
<WixVariable Id="WixUILicenseRtf" Value="docs\liscensing.rtf" />
<WixVariable Id="WixUIBannerBmp" Value="images\fplogo1.bmp" />
<WixVariable Id="WixUIDialogBmp" Value="images\fp-setup.bmp" />

<!-- Add Install conditions such as .Net version required and privileges -->
<PropertyRef Id="NETFRAMEWORK35_SP_LEVEL"/>
<Condition Message="This application requires .NET Framework 3.5 SP1. Please install the .NET Framework then run this installer again.">
  <![CDATA[Installed OR (NETFRAMEWORK35_SP_LEVEL and NOT NETFRAMEWORK35_SP_LEVEL = "#0")]]>
</Condition>

<Condition Message="You need to be an administrator to install this product.">
  Privileged
</Condition>

<Media Id="1" Cabinet="My.cab" EmbedCab="yes" />

<!-- Default to installing for all users / everyone -->
<Property Id="ALLUSERS">1</Property>


<!-- Win64="$(var.Win64)" -->
<Property Id="INSTALLDIR">
  <RegistrySearch Id="RegistrySearch" Type="raw" Root="HKLM" 
            Key="Software\[Manufacturer]\[ProductName]" Name="InstallLocation" />
</Property>

<!-- Add Remove Programs properties -->
<Property Id="ARPPRODUCTICON" Value="MyIcon.exe" />
<Property Id="ARPHELPLINK" Value="$(var.ArpHelpUrl)" />

<!-- Base Install Directory  - Define Directory Structures -->
<Directory Id="TARGETDIR" Name="SourceDir">
  <Directory Id="ProgramFilesFolder">
    <Directory Id="APPLICATIONFOLDER" Name="MyWix">
      <Directory Id="ArchDir" Name="$(var.ArchDir)" />
      <Directory Id="LogDir" Name="$(var.LogDir)" />
      <Directory Id="TempDir" Name="$(var.TempDir)" />
    </Directory>
  </Directory>

  <Directory Id="ProgramMenuFolder" Name="Programs">
    <Directory Id="ApplicationProgramsDir" Name="MyWix" />
  </Directory>

  <Directory Id="DesktopFolder" Name="Desktop" />
</Directory>

<!-- Application Directory and Structure-->
<DirectoryRef Id="APPLICATIONFOLDER">
  <Component Id="My.exe" Guid="MYGUID">
    <File Id="My.exe.file" Name="$(var.Project.TargetFileName)"
          Source="$(var.Project.TargetPath)" DiskId="1" KeyPath="yes" Vital="yes">
    </File>
  </Component>
</DirectoryRef >



<!-- Features to install, these could include the main exe, help docs, and scanner components -->
<Feature Id="Complete" Title="Product" Description="The complete package"
         Display="expand" Level="1" ConfigurableDirectory="APPLICATIONFOLDER">
  <Feature Id="MainApplication" Title="Installer Wix" Level="1">
    <ComponentRef Id="My.exe"/>
    <ComponentRef Id="RegistryEntries"/>
    <ComponentRef Id="ApplicationStartMenuShortCut" />
  </Feature>
</Feature>
</Product> 
</Wix>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

扛刀软妹 2024-08-27 07:22:04

没关系,由于某种原因,在 Visual Studio 2008 中创建新的 .wxs 文件后,它没有链接,可能是因为它最初是作为 .wxi 文件创建的。

我排除并重新包含该文件,进行了清理和构建,现在它可以工作了。

Never mind for some reason I it wasn't linking after I created the new .wxs file in Visual Studio 2008 possibly because it was originally created as a .wxi file.

I excluded and re-included the file, did a clean and build and its working now.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文