WIX Property as Integer

懵懂的女人 提交于 2019-12-10 21:02:04

问题


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

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

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"  />

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:

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.

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.

Thanks in advance


回答1:


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...

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...



来源:https://stackoverflow.com/questions/13639407/wix-property-as-integer

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!