开发者

How to bootstrap .NET service pack?

开发者 https://www.devze.com 2023-04-13 08:48 出处:网络
I have to build an installer for an .NET application that requires .NET Framework 2.0 SP2. When I add the .NET Framework as found in WiX Tutorial I get the .NET Framework 2.0 without service pack.

I have to build an installer for an .NET application that requires .NET Framework 2.0 SP2. When I add the .NET Framework as found in WiX Tutorial I get the .NET Framework 2.0 without service pack.

What is necessary to get the required service pack 开发者_StackOverflow中文版2 into the installation?

Edit: Is there any chance to rebuild an installer without the service pack when Windows Update has installed the service pack for the current .NET framework?


From the WiX Doco: (Not sure if that helps the 'Edit' part of your question)

Once the property is referenced you can use it in any WiX condition statement. For example, the following condition blocks installation if .NET Framework 2.0 is not installed.

<Condition Message="This application requires .NET Framework 2.0. Please install the .NET Framework then run this installer again.">
    <![CDATA[Installed OR NETFRAMEWORK20]]>
</Condition>

Installed is a Windows Installer property that ensures the check is only done when the user is installing the application, rather than on a repair or remove. The NETFRAMEWORK20 part of the condition will pass if .NET Framework 2.0 installed. If it is not set the installer will display the error message then abort the installation process.

To check against the service pack level of the framework use the *_SP_LEVEL properties. The following condition blocks installation if .NET Framework 3.0 SP1 is not present on the machine.

<Condition Message="This application requires .NET Framework 3.0 SP1. Please install the .NET Framework then run this installer again.">
    <![CDATA[Installed OR (NETFRAMEWORK30_SP_LEVEL and NOT NETFRAMEWORK30_SP_LEVEL = "#0")]]>
</Condition>

As with the previous example Installed prevents the check from running when the user is doing a repair or remove. The NETFRAMEWORK30_SP_LEVEL property is set to "#1" if Service Pack 1 is present. Since there is no way to do a numerical comparison against a value with a # in front of it, the condition first checks to see if the NETFRAMEWORK30_SP_LEVEL is set and the confirms that it is set to a number. This will correctly indicate whether any service pack for .NET 3.0 is installed.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号