使用 Wix bootstrap UI 创建的安装程序总是尝试安装 dot net 框架,尽管它存在
Installer created using Wix bootstrap UI always trying to install dot net framework though it exists
我使用 Wix Bootstrap 安装程序创建了一个 exe 安装程序。我点击installer安装的时候,总是提示安装dont net framework的对话框。但是我已经有了这个点网框架。当我点击安装时,没有任何反应,一切都关闭了。
下面是我的 class 扩展了 BootstrapperApplication。
public class CustomBootstrapperApplication : BootstrapperApplication
{
public static Dispatcher Dispatcher { get; set; }
protected override void Run()
{
Dispatcher = Dispatcher.CurrentDispatcher;
var model = new BootstrapperApplicationModel(this);
var viewModel = new InstallViewModel(model);
var view = new InstallView(viewModel);
model.SetWindowHandle(view);
this.Engine.Detect();
view.Show();
Dispatcher.Run();
this.Engine.Quit(model.FinalResult);
}
}
下面是我的AssemblyInfo.cs
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using CustomBA;
using Microsoft.Tools.WindowsInstallerXml.Bootstrapper;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("CustomBA")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CustomBA")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("0640182b-2d21-4f58-ad2a-7a4efc1d5d94")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: BootstrapperApplication(
typeof(CustomBootstrapperApplication))]
下面是我的BootstrapCore.config文件
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="wix.bootstrapper" type="Microsoft.
Tools.WindowsInstallerXml.Bootstrapper.BootstrapperSectionGroup,
BootstrapperCore">
<section name="host" type="Microsoft.Tools.
WindowsInstallerXml.Bootstrapper.HostSection, BootstrapperCore" />
</sectionGroup>
</configSections>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.5" />
</startup>
<wix.bootstrapper>
<host assemblyName="CustomBA" />
</wix.bootstrapper>
</configuration>
我将此项目添加为我的 Bootstrap 项目的依赖项。下面是 bootstrap 项目的 Product.wxs.
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" >
<Bundle Name="MyBootstrapper" Version="1.0.0.0" Manufacturer="WiX Tests" UpgradeCode="416b6bbf-2beb-4187-9f83-cdb764db2840">
<BootstrapperApplicationRef Id="ManagedBootstrapperApplicationHost">
<Payload SourceFile="$(var.CustomBA.TargetDir)CustomBA.dll" />
<Payload SourceFile= "$(var.CustomBA.TargetDir)BootstrapperCore.config" />
<Payload SourceFile= "$(var.CustomBA.TargetDir)BootstrapperCore.xml" />
<Payload SourceFile= "$(var.CustomBA.TargetDir)Microsoft.Practices.Prism.Mvvm.Desktop.dll" />
<Payload SourceFile= "$(var.CustomBA.TargetDir)Microsoft.Practices.Prism.Mvvm.dll" />
<Payload SourceFile= "$(var.CustomBA.TargetDir)Microsoft.Practices.Prism.SharedInterfaces.dll" />
</BootstrapperApplicationRef>
<WixVariable Id="WixMbaPrereqLicenseUrl" Value=""/>
<WixVariable Id="WixMbaPrereqPackageId" Value=""/>
<Chain>
<MsiPackage Id="Myapp" SourceFile="Lib\MyInstaller.msi" Compressed="yes" Vital="yes" />
</Chain>
</Bundle>
</Wix>
为什么我会遇到这个问题?我确实安装了 dot net 4.5。请指教
在 BootstrapperCore.config 中,您的 supportedRuntime
元素对于 v4.5 的值不正确,需要
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
我使用 Wix Bootstrap 安装程序创建了一个 exe 安装程序。我点击installer安装的时候,总是提示安装dont net framework的对话框。但是我已经有了这个点网框架。当我点击安装时,没有任何反应,一切都关闭了。
下面是我的 class 扩展了 BootstrapperApplication。
public class CustomBootstrapperApplication : BootstrapperApplication
{
public static Dispatcher Dispatcher { get; set; }
protected override void Run()
{
Dispatcher = Dispatcher.CurrentDispatcher;
var model = new BootstrapperApplicationModel(this);
var viewModel = new InstallViewModel(model);
var view = new InstallView(viewModel);
model.SetWindowHandle(view);
this.Engine.Detect();
view.Show();
Dispatcher.Run();
this.Engine.Quit(model.FinalResult);
}
}
下面是我的AssemblyInfo.cs
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using CustomBA;
using Microsoft.Tools.WindowsInstallerXml.Bootstrapper;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("CustomBA")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CustomBA")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("0640182b-2d21-4f58-ad2a-7a4efc1d5d94")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: BootstrapperApplication(
typeof(CustomBootstrapperApplication))]
下面是我的BootstrapCore.config文件
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="wix.bootstrapper" type="Microsoft.
Tools.WindowsInstallerXml.Bootstrapper.BootstrapperSectionGroup,
BootstrapperCore">
<section name="host" type="Microsoft.Tools.
WindowsInstallerXml.Bootstrapper.HostSection, BootstrapperCore" />
</sectionGroup>
</configSections>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.5" />
</startup>
<wix.bootstrapper>
<host assemblyName="CustomBA" />
</wix.bootstrapper>
</configuration>
我将此项目添加为我的 Bootstrap 项目的依赖项。下面是 bootstrap 项目的 Product.wxs.
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" >
<Bundle Name="MyBootstrapper" Version="1.0.0.0" Manufacturer="WiX Tests" UpgradeCode="416b6bbf-2beb-4187-9f83-cdb764db2840">
<BootstrapperApplicationRef Id="ManagedBootstrapperApplicationHost">
<Payload SourceFile="$(var.CustomBA.TargetDir)CustomBA.dll" />
<Payload SourceFile= "$(var.CustomBA.TargetDir)BootstrapperCore.config" />
<Payload SourceFile= "$(var.CustomBA.TargetDir)BootstrapperCore.xml" />
<Payload SourceFile= "$(var.CustomBA.TargetDir)Microsoft.Practices.Prism.Mvvm.Desktop.dll" />
<Payload SourceFile= "$(var.CustomBA.TargetDir)Microsoft.Practices.Prism.Mvvm.dll" />
<Payload SourceFile= "$(var.CustomBA.TargetDir)Microsoft.Practices.Prism.SharedInterfaces.dll" />
</BootstrapperApplicationRef>
<WixVariable Id="WixMbaPrereqLicenseUrl" Value=""/>
<WixVariable Id="WixMbaPrereqPackageId" Value=""/>
<Chain>
<MsiPackage Id="Myapp" SourceFile="Lib\MyInstaller.msi" Compressed="yes" Vital="yes" />
</Chain>
</Bundle>
</Wix>
为什么我会遇到这个问题?我确实安装了 dot net 4.5。请指教
在 BootstrapperCore.config 中,您的 supportedRuntime
元素对于 v4.5 的值不正确,需要
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />