I am trying to install .NET Framework 4.7.2 developed COM+ component using WiX 3.11.2.
And it fails doing this with the following error in the log:
Action 14:38:48: RegisterComPlusAssemblies. Registering COM+ components
RegisterComPlusAssemblies: DLL: C:\Program Files (x86)\WiXTestingComPlusApplication\NET472ServicedComponent.dll
ComPlusInstallExecute: ExceptionInfo: Code='0', Source='System.EnterpriseServices', Description='Failed to load assembly 'c:\program files (x86)\wixtestingcomplusapplication\net472servicedcomponent.dll'.', HelpFile='', HelpContext='0'
ComPlusInstallExecute: Error 0x80020009: Failed to invoke RegistrationHelper.InstallAssembly() method
ComPlusInstallExecute: Error 0x80020009: Failed to register .NET assembly
ComPlusInstallExecute: Error 0x80020009: Failed to register assembly, key: ComPlusAssembly_NET472ServicedComponent
ComPlusInstallExecute: Error 0x80020009: Failed to register assemblies CustomAction ComPlusInstallExecute returned actual error code 1603 (note this may not be 100% accurate if translation happened inside sandbox)
In the binding log, I can see that there was an attempt to load the .NET 4.7.2 based COM+ component assembly using .NET 2.0 runtime:
Assembly Binder Log Entry (11/15/2019 @ 2:38:49 PM)
The operation failed.
Bind result: hr = 0x8013101b. No description available.
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll
Running under executable C:\Windows\syswow64\MsiExec.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: User = NT AUTHORITY\SYSTEM LOG: Where-ref bind. Location = c:\program files (x86)\wixtestingcomplusapplication\net472servicedcomponent.dll
LOG: Appbase = file:///C:/Windows/syswow64/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = NULL
Calling assembly : (Unknown).
===
LOG: This bind starts in LoadFrom load context.
WRN: Native image will not be probed in LoadFrom context. Native image will only be probed in default load context, like with Assembly.Load().
LOG: No application configuration file found.
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Attempting download of new URL file:///c:/program files (x86)/wixtestingcomplusapplication/net472servicedcomponent.dll.
LOG: Assembly download was successful. Attempting setup of file: c:\program files (x86)\wixtestingcomplusapplication\net472servicedcomponent.dll
LOG: Entering run-from-source setup phase. ERR: Error extracting manifest import from file (hr = 0x8013101b).
ERR: Failed to complete setup of assembly (hr = 0x8013101b). Probing terminated.
The error code means COR_E_NEWER_RUNTIME.
The custom action from WiX Toolset Extentions uses native DLL custom action to register the COM+ application.
And it looks like it is not using the latest version of the .NET Framework. Is there any way I could control it?
And of course it works fine if ServicedComponent is using .NET Framework 2.0.
I have created a small demo for the problem here.
UPDATE - added WiX wxs file contents
<ComponentGroup Id="NET20ServicedComponent" Directory="INSTALLFOLDER">
<Component Id="Component_NET20ServicedComponent" Guid="{49682A46-A29D-45EE-863A-C0F9935CDB35}" KeyPath="yes">
<File Id="File_NET20ServicedComponent.dll" Source="$(var.NET20ServicedComponent.TargetPath)"/>
<File Id="File_NET20ServicedComponent.tlb" Source="$(var.NET20ServicedComponent.TargetDir)NET20ServicedComponent.tlb"/>
<complus:ComPlusApplication Id="ComPlusApplication_NET20ServicedComponent"
Name="NET20ServicedComponent"
Description="Testing NET20ServicedComponent">
<complus:ComPlusAssembly Id="ComPlusAssembly_NET20ServicedComponent"
DllPathFromGAC="no"
DllPath="[#File_NET20ServicedComponent.dll]"
TlbPath="[#File_NET20ServicedComponent.tlb]"
Type=".net"/>
</complus:ComPlusApplication>
</Component>
</ComponentGroup>
<ComponentGroup Id="NET472ServicedComponent" Directory="INSTALLFOLDER">
<Component Id="Component_NET472ServicedComponent" Guid="{885DB376-CF66-4C46-AF14-4436C6B76EB5}" KeyPath="yes">
<File Id="File_NET472ServicedComponent.dll" Source="$(var.NET472ServicedComponent.TargetPath)"/>
<File Id="File_NET472ServicedComponent.tlb" Source="$(var.NET472ServicedComponent.TargetDir)NET472ServicedComponent.tlb"/>
<complus:ComPlusApplication Id="ComPlusApplication_NET472ServicedComponent"
Name="NET472ServicedComponent"
Description="Testing NET472ServicedComponent">
<complus:ComPlusAssembly Id="ComPlusAssembly_NET472ServicedComponent"
DllPathFromGAC="no"
DllPath="[#File_NET472ServicedComponent.dll]"
TlbPath="[#File_NET472ServicedComponent.tlb]"
Type=".net"/>
</complus:ComPlusApplication>
</Component>
</ComponentGroup>
User contributions licensed under CC BY-SA 3.0