AnOldSoul
AnOldSoul

Reputation: 4207

Installer created using Wix bootstrap UI always trying to install dot net framework though it exists

I have created an exe installer using Wix Bootstrap installer. When I click on the installer to install it, it always prompt the dialog box asking to install dont net framework. But I already have this dot net framework. When I click onto install, nothing happens, everything closes.

Below is my class that extends 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);
    }
}

Below is my 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))]

Below is my BootstrapCore.config file

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

I added this project as a dependency to my Bootstrap project. Below is the bootstrap project's 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>

Why am I getting this issue? I do have dot net 4.5 installed. Please advice.

Upvotes: 0

Views: 279

Answers (1)

Sean Hall
Sean Hall

Reputation: 7878

In BootstrapperCore.config, your supportedRuntime element has the wrong value for v4.5, it needs to be

<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />

Upvotes: 2

Related Questions