WixUIExtension.dll could not be loaded

2019-07-24 16:01发布

问题:

I'm trying to make a wix installer. for a web application.

the following is my wsx v3.11 File

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
  <Product Id="Guid" Name="TestInstaller" Language="1033" Version="1.0.0.0" Manufacturer="CompanyName" UpgradeCode="Guid1">
    <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" Platform="x64" />

    <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
    <MediaTemplate EmbedCab="yes" />
    <PropertyRef Id="WIX_IS_NETFRAMEWORK_462_OR_LATER_INSTALLED"/>
    <Condition Message='This setup requires the .NET Framework 4.7 client profile installed.'>
      <![CDATA[Installed OR WIX_IS_NETFRAMEWORK_462_OR_LATER_INSTALLED]]>
    </Condition>
    <Feature Id="Complete" Title="TestInstaller" Description="TestInstaller" Level="1" ConfigurableDirectory='INSTALLFOLDER'>
      <ComponentGroupRef Id="ProductComponents" />
      <ComponentGroupRef Id="ProductBinComponents" />

    </Feature>


    <UIRef Id="WixUI_Mondo" />
    <UIRef Id="WixUI_ErrorProgressText" />
  </Product>

  <Fragment>
    <Directory Id="TARGETDIR" Name="SourceDir">
     <Directory Id="INSTALLFOLDER" Name="Test Installer" >
        <Directory Id="INSTALLBINFOLDER" Name="bin">
        </Directory>
      </Directory>
    </Directory>
  </Fragment>

  <Fragment>
    <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
      <Component Id="ProductComponent" Win64="yes" Guid="*">
        <File Source="C:\Temp\Publish\Web.config" />
        <File Source="C:\Temp\Publish\NLog.config"/>
        <File Source="C:\Temp\Publish\Global.asax"/>
      </Component>
    </ComponentGroup>
    <ComponentGroup Id="ProductBinComponents" Directory="INSTALLBINFOLDER">
      <Component Id="ProductBinComponent" Win64="yes" Guid="*">
        <File Source="C:\Temp\Publish\bin\Antlr3.Runtime.dll"/>
        <File Source="C:\Temp\Publish\bin\Antlr3.Runtime.pdb"/>
      </Component>
    </ComponentGroup>
  </Fragment>
</Wix>

my problem here is that I don't know what this error message means and by extension have no clue how to fix it.

Either 'Microsoft.Tools.WindowsInstallerXml.AssemblyDefaultWixExtensionAttribute' was not defined in the assembly or the type defined in extension '..........\Program Files (x86)\WiX Toolset v3.11\bin\WixUIExtension.dll' could not be loaded.

回答1:

1. RTF License File: First make sure you have created your own RTF license file (using WordPad or similar) and then specify to use this RTF file in your WiX source like this:

<!-- Shown for context (one of several possible dialog sets): -->
<UIRef Id="WixUI_Mondo" /> 

<!-- The crucial variable that must be defined (for this dialog set): -->
<WixVariable Id="WixUILicenseRtf" Value="TestLicenseAgreement.rtf" />   

For more context and details, please see this example of what minimal tweaks are needed to a fresh WiX project to get it to compile (see inline comments in WiX markup towards bottom).


2. Wix.dll: It might be that you have included a reference directly to Wix.dll in addition to WixUIExtension and WixNtFxExtension - both of which you need to keep included.

So in other words: remove the project reference to Wix.dll and try to recompile.

If that does not work, remove all references and re-add only WixUIExtension and WixNtFxExtension.


Some Suggestions & Links:

  • Similar issue: Where do I find Microsoft.Tools.WindowsInstallerXml.dll?
  • Maybe use a different source path than a temp directory.
  • Maybe exclude the *.pdb file from installation, unless you need it for debugging.
  • Use one file per component. IMHO this prevents all kinds of problems.
  • Strip your GUIDs from WiX sources before posting them - or they could be copy / pasted. Not good at all.