处理 WIX 警告的正确方法:LGHT1076:ICE48
我想将我的 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
如果您想遵循最佳实践(我认为您不会在这里这样做,因为您提到它是一个“内部”安装程序),您不应该使用硬代码路径。选择一个属性,例如
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 ifWindowsVolume
happens to not beC:
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.
如果您只想引用目录树中的某个目录作为属性,那么它是本机支持的。引用 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"
就我而言,为了消除此警告,我选择从属性中删除默认值。
例如,这个(没有 ICE48 警告):
而不是这个(ICE48 警告):
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):
instead of this (ICE48 warning):
您可以将
与[WindowVolume]
元素结合使用来解决这个问题:You can use the
<SetProperty>
in conjuction with[WindowVolume]
element to solve that: