Installation of an MSI package shows "Assembly Error: The assembly is built by a runtime newer than the currently loaded runtime, and cannot be loaded." error

While working on a customer case involving a Windows installer based package, we came across an interesting issue that was preventing the installation of the MSI package on a particular computer.

The setup failed with the following error message that we captured from a verbose log.

Error message: Assembly Error: The assembly is built by a runtime newer than the currently loaded runtime, and cannot be loaded.

Log snippet:

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------

MSI (s) (B4:98) [00:42:12:401]: Executing op: SetTargetFolder(Folder=C:\Program Files (x86)\)

MSI (s) (B4:98) [00:42:12:401]: Executing op: SetSourceFolder(Folder=1\ProgramF\boziguka\|Program Files\Global Assembly Cache\)

MSI (s) (B4:98) [00:42:12:401]: Executing op: ChangeMedia(,MediaPrompt=Please insert the disk: [ProductName] ,MediaCabinet=Cabs.m4,BytesPerTick=32768,CopierType=2,ModuleFileName=C:\Windows\Installer\30895a.msi,,,,,IsFirstPhysicalMedia=1)

MSI (s) (B4:98) [00:42:12:401]: Executing op: AssemblyCopy(SourceName=nobzwco5.dll|CustomerPrivate.dll,SourceCabKey=CustomerPrivate.dll.A15E27FB_AF96_4B01_A086_134C0E9A760B,

DestName=CustomerPrivate.dll,Attributes=512,FileSize=108544,PerTick=32768,,VerifyMedia=1,,,,,ComponentId={20D5E9E9-8110-45C3-9320-DA65098CBBA9},IsManifest=1,,,AssemblyMode=0,)

MSI (s) (B4:98) [00:42:12:401]: Source for file 'CustomerPrivate.dll.A15E27FB_AF96_4B01_A086_134C0E9A760B' is compressed

InstallFiles: File: CustomerPrivate.dll,  Directory: ,  Size: 108544

MSI (s) (B4:98) [00:42:12:401]: Note: 1: 2360

MSI (s) (B4:98) [00:42:12:401]: Note: 1: 2360

MSI (s) (B4:98) [00:42:12:401]: Note: 1: 2360

MSI (s) (B4:58) [00:42:12:651]: Assembly Error:The assembly is built by a runtime newer than the currently loaded runtime, and cannot be loaded.

MSI (s) (B4:58) [00:42:12:667]: Note: 1: 1935 2:  3: 0x8013101B 4: IStream 5: Commit 6: 

MSI (s) (B4:98) [00:42:12:667]: Note: 1: 1304 2: CustomerPrivate.dll

DEBUG: Error 2835:  The control ErrorIcon was not found on dialog ErrorDialog

Internal Error 2835. ErrorIcon, ErrorDialog

Error 1304. Error writing to file: CustomerPrivate.dll.  Verify that you have access to that directory.

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------

On further investigation, we found that we were getting the error message on a machine that only had .NET Framework 3.5 SP1, where the runtime is still at 2.0 version.

Later, we also found that the component that is installing the DLL file had the following condition

MsiNetAssemblySupport > "2.0"

This means, the application needed a .Net runtime version greater than 2.0 to be installed prior to running this setup package.

Resolution: Installing .NET Framework 4.0 fixed this issue.

Further reference:

https://msdn.microsoft.com/en-us/library/windows/desktop/aa370325(v=vs.85).aspx

 

Content By : Keshav Jain.