WIX installer with custom actions: "built using a runtime that is newer than the currently loaded runtime and cannot be downloaded."

I have a WIX installer that performs custom actions during the installation process. When I run the WIX installer and encounters its first user action, the setup program crashes and I get an error message in the MSI log as follows:

Beginning of action 12:03:53: LoadBCAConfigDefaults. SFXCA: extract custom action to temporary directory: C: \ DOCUME ~ 1 \ ELOY06 ~ 1 \ LOCALS ~ 1 \ Temp \ MSI10C.tmp- \ SFXCA: bind to CLR version v2.0.50727 Invoke custom action WIXCustomActions! WIXCustomActions.CustomActions.LoadBCAConfigDefaults Error: Failed to load custom action class WIXCustomActions.CustomActions from assembly: WIXCustomActions System.BadImageFormatException: Failed to load file or assembly "WIXCustomActions" or one of its dependencies. This assembly is built using a runtime that is newer than the currently loaded runtime and cannot be loaded. File name: 'WIXCustomActions' in System.Reflection.Assembly._nLoad (AssemblyName fileName, String codeBase, Evidence assemblySecurity,Assembly locationHint, StackCrawlMark & ​​stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) in System.Reflection.Assembly.nLoad (AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark & ​​stackMark, BooleleroOflen .InternalLoad (AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark & ​​stackMark, Boolean forIntrospection) in System.Reflection.Assembly.InternalLoad (String assemblyString, Evidence assemblySecurity, StackCrawlMark & ​​stackMark, Boolean forIntrospectionDomain). .Deployment.WindowsInstaller.CustomActionProxy.GetCustomActionMethod (session, String assemblyName, String className, String methodName)Stackackrawlmark AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark & ​​stackMark, Boolean forIntrospection) in System.Reflection.Assembly.InternalLoad (String assemblyString, Evidence assemblySecurity, StackCrawlMark & ​​stackMark, Boolean forIntrospection) in System.AppD String Assembly.Location. WindowsInstaller.CustomActionProxy.GetCustomActionMethod (session, String assemblyName, String className, String methodName)Stackackrawlmark AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark & ​​stackMark, Boolean forIntrospection) in System.Reflection.Assembly.InternalLoad (String assemblyString, Evidence assemblySecurity, StackCrawlMark & ​​stackMark, Boolean forIntrospection) in System.AppD String Assembly.Location. WindowsInstaller.CustomActionProxy.GetCustomActionMethod (session, String assemblyName, String className, String methodName)Boolean throwOnFileNotFound, Boolean forIntrospection) in System.Reflection.Assembly.nLoad (AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark & ​​stackMark, Boolean throwOnFileNotFound, Boolean forAnalogReflection Library assemblySecurity, StackCrawlMark & ​​stackMark, Boolean forIntrospection) in System.Reflection.Assembly.InternalLoad (String assemblyString, Evidence assemblySecurity, StackCrawlMark & ​​stackMark, Boolean forIntrospection) in System.AppDomain.Load (String assemblyStream.modulation.module. GetCustomActionMethod (session, String assemblyName, String className, String methodName)Boolean throwOnFileNotFound, Boolean forIntrospection) in System.Reflection.Assembly.nLoad (AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark & ​​stackMark, Boolean throwOnFileNotFound, Boolean forAnalogReflection Library assemblySecurity, StackCrawlMark & ​​stackMark, Boolean forIntrospection) in System.Reflection.Assembly.InternalLoad (String assemblyString, Evidence assemblySecurity, StackCrawlMark & ​​stackMark, Boolean forIntrospection) in System.AppDomain.Load (String assemblyStream.modulation.module. GetCustomActionMethod (session, String assemblyName, String className, String methodName)nLoad (AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark & ​​stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) in System.Reflection.Assembly.InternalLoad (AssemblyName assemblyRef, Evidence assemblySearkMlecklecklecklecklecklecklecklearkeckleckleck, assembly .Assembly.InternalLoad (String assemblyString, Evidence assemblySecurity, StackCrawlMark & ​​stackMark, Boolean forIntrospection) in System.AppDomain.Load (String assemblyString) in Microsoft.Deployment.WindowsInstaller.CustomActionProxy.GetCustomActionMethod classNamename session method )nLoad (AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark & ​​stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) in System.Reflection.Assembly.InternalLoad (AssemblyName assemblyRef, Evidence assemblySearkMlecklecklecklecklecklecklecklearkeckleckleck, assembly .Assembly.InternalLoad (String assemblyString, Evidence assemblySecurity, StackCrawlMark & ​​stackMark, Boolean forIntrospection) in System.AppDomain.Load (String assemblyString) in Microsoft.Deployment.WindowsInstaller.CustomActionProxy.GetCustomActionMethod classNamename session method )Boolean forIntrospection) in System.Reflection.Assembly.InternalLoad (AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark & ​​stackMark, Boolean forIntrospection) in System.Reflection.Assembly.InternalLoad (String assemblyString, Evidence assemblySecurity, & StackCanMarkMark AppDomain.Load (String assemblyString) in Microsoft.Deployment.WindowsInstaller.CustomActionProxy.GetCustomActionMethod (session, String assemblyName, String className, String methodName)Boolean forIntrospection) in System.Reflection.Assembly.InternalLoad (AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark & ​​stackMark, Boolean forIntrospection) in System.Reflection.Assembly.InternalLoad (String assemblyString, Evidence assemblySecurity, & StackCanMarkMark AppDomain.Load (String assemblyString) in Microsoft.Deployment.WindowsInstaller.CustomActionProxy.GetCustomActionMethod (session, String assemblyName, String className, String methodName)Boolean forIntrospection) in System.AppDomain.Load (String assemblyString) in Microsoft.Deployment.WindowsInstaller.CustomActionProxy.GetCustomActionMethod (session, String assemblyName, String className, String methodName)Boolean forIntrospection) in System.AppDomain.Load (String assemblyString) in Microsoft.Deployment.WindowsInstaller.CustomActionProxy.GetCustomActionMethod (session, String assemblyName, String className, String methodName)

... : "System.BadImageFormatException: " WIXCustomActions " . , , , ."

, , - .NET - ( 3.5 , ), , . ?

.... , , CustomActions, , .dll, :

===============

"C:\Program Files\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"

@echo on

cd "C:\development\trunk\PortalsDev\csharp\production\Installers\WIX\customactions\PAServicesWIXCustomActions"

csc/target: library/r: "C:\program files\windows installer xml v3.6\sdk\microsoft.deployment.windowsinstaller.dll" /r: "C:\development\trunk\PortalsDev\csharp\\ \WIX\customactions\PAServicesWIXCustomActions\bin\Debug\eLoyalty.PortalLib.dll" /out: "C:\development\trunk\PortalsDev\csharp\production\Installers\WIX\customactions\PAServicesWIXCustomActions\bin\Debug\WIXCustomActions.dll" CustomActions.cs

cd "C:\Program Files\Windows Installer XML v3.6\SDK"

makefxca "C:\development\trunk\PortalsDev\csharp\production\Installers\WIX\customactions\PAServicesWIXCustomActions\bin\Debug\BatchCustomerAnalysisWIXCustomActionsPackage.dll" "c:\program files\windows installer xml v3.6\sdk\x86\sfxca.dll" "C:\development\trunk\PortalsDev\csharp\production\Installers\WIX\customactions\PAServicesWIXCustomActions\bin\Debug\WIXCustomActions.dll" customaction.config Microsoft.Deployment.WindowsInstaller.dll

+3
5

!

, csc, package.bat, 2.0 ...

, , c:\WINDOWS\Microsoft.NET\v3.5\ , v2.0.xxxxx, ..

+2

BadImageFormatException x86 x64 .

MSI 32-, , x86, , 64-, x64.

0

, MSI .net

0

, .

, , , .NET Framework.

0

, .net 4.6 dll .net 4.6, , , . , , , .net 4.6. :

<Custom Action="MyCustomAction" After="LaunchConditions">
0

Source: https://habr.com/ru/post/1782482/


All Articles