WIX 属性为整数 [英] WIX Property as Integer

查看:19
本文介绍了WIX 属性为整数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试设置一个属性,以在安装过程中创建的新网站上配置 IIS:Website ConnectionTimeout 值.

I am trying to set a a property to configure the IIS:Website ConnectionTimeout value on a new website that gets created during setup.

但是我不能,因为 ConnectionTimeout 的值必须是整数,而不是字符串.

However I am unable to, as the value for ConnectionTimeout must be an integer, not string.

在我的 product.wxs 中,我有以下内容:

In my product.wxs I have the following:

<Control Id="IisConnectionTimeoutLabel" Type="Text" X="45" Y="164" Width="100" Height="15" TabSkip="no" Text="Connection Timeout (sec):" />
<Control Id="IisConnectionTimeoutEdit" Type="Edit" X="45" Y="176" Width="220" Height="18" Property="IIS_CONNECTIONTIMEOUT" Text="{80}" Integer="yes"  />

在我的 IisConfiguration.wxs 中,我有以下内容:

And in my IisConfiguration.wxs I have the following:

<Property Id="IIS_CONNECTIONTIMEOUT" Value="300" />
<iis:WebSite Id="EersWebsite" Description="[IIS_WEBSITENAME]" ConfigureIfExists="yes" Directory="WEBINSTALLDIR" DirProperties="EersWebsiteDirProperties" ConnectionTimeout="[IIS_CONNECTIONTIMEOUT]">

当我构建项目时,我得到以下信息:

When I build the project I get the following:

'ConnectionTimeout' 属性无效 - 值'[IIS_CONNECTIONTIMEOUT]' 根据其数据类型无效'http://www.w3.org/2001/XMLSchema:nonNegativeInteger' - 字符串[IIS_CONNECTIONTIMEOUT]"不是有效的整数值.

The 'ConnectionTimeout' attribute is invalid - The value '[IIS_CONNECTIONTIMEOUT]' is invalid according to its datatype 'http://www.w3.org/2001/XMLSchema:nonNegativeInteger' - The string '[IIS_CONNECTIONTIMEOUT]' is not a valid Integer value.

iis:WebSite/@ConnectionTimeout 属性的值,'[IIS_CONNECTIONTIMEOUT]',不是合法的整数值.合法的整数值从 -2,147,483,648 到 2,147,483,647.

The iis:WebSite/@ConnectionTimeout attribute's value, '[IIS_CONNECTIONTIMEOUT]', is not a legal integer value. Legal integer values are from -2,147,483,648 to 2,147,483,647.

提前致谢

推荐答案

如错误消息所述,ConnectionTimeout 的值属性需要整数值.nonNegativeInteger 不是 Formatted 类型,它知道如何从方括号中提供的属性中提取值.

As the error message states, the value of the <iis:WebSite>'s ConnectionTimeout attribute expects the integer value. The nonNegativeInteger is not a Formatted type, which knows how to extract values out of properties provided in square brackets.

因此,我认为除了提供硬编码值之外,您没有其他方法......

Hence, I don't think you have a way here apart from providing the hard-coded value...

或者,您可以创建一个调用 appcmd.exe 的自定义操作,并在命令行中提供所需的超时值,并在 ConfitureIIs 之后安排此操作延迟代码>...但努力似乎远远大于收益...

Alternatively, you can create a custom action, which calls for appcmd.exe, and provide the required timeout value in the command-line, and schedule this action deferred after ConfitureIIs... But the efforts seem much bigger than the benefit...

这篇关于WIX 属性为整数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆