2013-12-20 42 views
5

我的应用程序是针对.NET 2.0框架编译的,但我希望用户能够在Windows 8上安装它,而不会提示您安装.NET 3.5。为了提供一些背景资料,我有以下app.config文件:如何在WiX中指定最低要求的.NET框架版本

<?xml version="1.0" encoding="utf-8" ?> 
<configuration> 
    <startup> 
     <supportedRuntime version="v4.0"/> 
     <supportedRuntime version="v2.0.50727"/> 
    </startup> 
    <runtime> 
     <NetFx40_LegacySecurityPolicy enabled="true"/> 
    </runtime> 
</configuration> 

我的问题是,在维克斯.wxs文件,我需要说明,我的应用程序将运行针对该框架的每一个版本,如:

<PropertyRef Id="NETFRAMEWORK20"/> 
<Condition Message="This application requires .NET Framework 2.0. Please install the .NET Framework then run this installer again."> 
    <![CDATA[Installed OR NETFRAMEWORK20 OR NETFRAMEWORK30 OR NETFRAMEWORK35_CLIENT OR NETFRAMEWORK35 OR NETFRAMEWORK40CLIENT OR NETFRAMEWORK40FULL OR NETFRAMEWORK45]]> 
</Condition> 

或者,我可以通过快捷键并指定是这样的:

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

回答

1

使用引导程序时,你可以做的是检查Windows版本和.NET版本 例如这里:

<ExePackage Id="Netfx45Xxx" Cache="no" Compressed="no" PerMachine="yes" Permanent="yes" Vital="no" InstallCommand="/q" 
SourceFile="..\SetupProject\dotnetfx45_full_x86_x64.exe" 
DetectCondition="(Netfx4FullVersion=&quot;4.5.50709&quot;) AND (NOT VersionNT64 OR (Netfx4x64FullVersion=&quot;4.5.50709&quot;))" 
InstallCondition="(VersionNT &gt;= v6.0 OR VersionNT64 &gt;= v6.0) AND (NOT (Netfx4FullVersion=&quot;4.5.50709&quot; OR Netfx4x64FullVersion=&quot;4.5.50709&quot;))" /> 

因此,大家可以看到有一个检测条件和安装条件,其中检查Windows版本和.NET版本。

+0

纠正我,如果我错了,但它看起来像这条语句试图安装.NET 4.5,这不是我的目标。 – CtrlDot

+0

以及逻辑是相同的ü可以安装您的setup.exe文件,而不是.net 4.5文件,这是我的案例中的源文件。而不是检查.net 4.5和windows xp,你可以检查.net 2.0,你将不会被提示输入其他内容。 – Gilad