处理 WIX 警告的正确方法:LGHT1076:ICE48

发布于 2024-09-08 02:53:20 字数 830 浏览 1 评论 0原文

我想将我的 wix 安装中的属性默认为硬编码目录。是否有一种“正确”的方法来编码默认值(注意,这是一个内部项目,而不是分发给公众的东西),所以我不会收到以下警告:

LGHT1076: ICE48 Directory 'FOO' appears to be hardcoded in the property table to a local drive.

wix 文件看起来像这样:

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
     xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
  <Product Id="22E1F223-E3AD-45F8-A394-1289AAAA64C8"
           Name="MyService"
           Language="1033" Version="1.0.0.0"
           UpgradeCode="140F5A44-58DA-4364-876B-9D9484C04CD9">
    <Package InstallerVersion="200" Compressed="yes" />

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

    <Property Id="FOO" Value="C:\MyRootDirectory\" />

对此有什么想法吗?

I want to default a proptery in my wix installation to a hardcoded directory. Is there a "correct" way to encode a default value (note, this is an internal project, not something distributed to the public) so I don't get the following warning:

LGHT1076: ICE48 Directory 'FOO' appears to be hardcoded in the property table to a local drive.

The wix file looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
     xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
  <Product Id="22E1F223-E3AD-45F8-A394-1289AAAA64C8"
           Name="MyService"
           Language="1033" Version="1.0.0.0"
           UpgradeCode="140F5A44-58DA-4364-876B-9D9484C04CD9">
    <Package InstallerVersion="200" Compressed="yes" />

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

    <Property Id="FOO" Value="C:\MyRootDirectory\" />

Any thoughts on this?

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

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

发布评论

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

评论(4

无人问我粥可暖 2024-09-15 02:53:20

如果您想遵循最佳实践(我认为您不会在这里这样做,因为您提到它是一个“内部”安装程序),您不应该使用硬代码路径。选择一个属性,例如 WindowsVolume并将您的应用程序设计得灵活,如果 WindowsVolume 恰好不是 C:

如果您真的不关心这一点,您可以使用自定义在安装开始时将属性设置为您想要的内容的操作。在 UI 和执行序列中尽早安排一个简单的 Type 51 CA(设置属性)将很好地实现这一点。这样,该属性在验证运行时不会有违规值,但会在安装开始时立即获取该值。

If you want to follow best practices ( I don't think you do here since you mention it's an 'internal' installer ) you shouldn't ever hard code paths. Choose a property like WindowsVolume and design your application to be flexible if WindowsVolume happens to not be C:

If you really don't care about this, you can use a custom action to set the property to what you want at the very beginning of the install. A simple Type 51 CA ( Set Property ) scheduled early on in both the UI and Execute Sequence will do the trick nicely. This way the property doesn't have the offending value when validation runs but then gets the value right away at the beginning of the install.

烟若柳尘 2024-09-15 02:53:20

如果您只想引用目录树中的某个目录作为属性,那么它是本机支持的。引用 MSDN,“在 CostFinalize 操作期间解析目录时,目录表中的键成为设置为目录路径的属性

If you only want to reference a certain directory in your directory tree as a property, then it is natively supported. Quoting MSDN, "When the directories are resolved during the CostFinalize action, the keys in the Directory table become properties set to directory paths"

我是有多爱你 2024-09-15 02:53:20

就我而言,为了消除此警告,我选择从属性中删除默认值。
例如,这个(没有 ICE48 警告):

<Property Id="VS2010INSTALLDIR">
    <RegistrySearch Id="VS2010_InstallDir" Root="HKLM" Key="SOFTWARE\Microsoft\VisualStudio\10.0" Name="InstallDir" Type="raw" />
</Property>

而不是这个(ICE48 警告):

<Property Id="VS2010INSTALLDIR" Value="0">
    <RegistrySearch Id="VS2010_InstallDir" Root="HKLM" Key="SOFTWARE\Microsoft\VisualStudio\10.0" Name="InstallDir" Type="raw" />
</Property>

In my case, to get rid of this warning I chose to remove the default value from the property.
For example, this (no ICE48 warning):

<Property Id="VS2010INSTALLDIR">
    <RegistrySearch Id="VS2010_InstallDir" Root="HKLM" Key="SOFTWARE\Microsoft\VisualStudio\10.0" Name="InstallDir" Type="raw" />
</Property>

instead of this (ICE48 warning):

<Property Id="VS2010INSTALLDIR" Value="0">
    <RegistrySearch Id="VS2010_InstallDir" Root="HKLM" Key="SOFTWARE\Microsoft\VisualStudio\10.0" Name="InstallDir" Type="raw" />
</Property>
晨曦÷微暖 2024-09-15 02:53:20

您可以将 [WindowVolume] 元素结合使用来解决这个问题:

<Product>
  <!-- Define your property with an empty value -->
  <Property Id="FOO" Value=""/>

  <!-- Set property to your target value, using the WindowVolume built-in property -->
  <SetProperty Id="FOO" Value="[WindowVolume]\MyRootDirectory\"
               After="LaunchConditions"/>
</Product>

You can use the <SetProperty> in conjuction with [WindowVolume] element to solve that:

<Product>
  <!-- Define your property with an empty value -->
  <Property Id="FOO" Value=""/>

  <!-- Set property to your target value, using the WindowVolume built-in property -->
  <SetProperty Id="FOO" Value="[WindowVolume]\MyRootDirectory\"
               After="LaunchConditions"/>
</Product>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文