PerlNet v9.5.1 on 64bit WinSrv2012R2 This assembly is built by a runtime newer than the currently loaded runtime and cannot be l

Posted by ska on 2016-08-15 02:34

Hi,

I'm migrating from a WSUS 3 installation on Srv2008 to the native WSUS role of a WinSrv2012R2.

However, I do not get the script running, because:

+ in order to get plc running, I had to install .Net v3.5,
+ when I try to compile a script I get:

PerlNET 9.5.1 build 300018
Copyright (C) 1998-2016 ActiveState Software Inc. All rights reserved.
Commercial license for ...

System.BadImageFormatException: Could not load file or assembly 'C:\Program Files\Update Services\Api\Microsoft.UpdateServices.Administration.dll' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.

File name: 'C:\Program Files\Update Services\Api\Microsoft.UpdateServices.Administration.dll'
at System.Reflection.AssemblyName.nGetFileInformation(String s)
at System.Reflection.AssemblyName.GetAssemblyName(String assemblyFile)
WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

If I understand the error correctly, plc generates code for CLR v3.5, but this assembly is for CLR 4.0. (ildasm tells that).

Can plc use .Net 4?

i-shenl
ActiveState Staff
Mon, 2016-08-15 08:07

It seems that the 32-bit versions don't have this problem. Please give them a try.

ska | Tue, 2016-08-16 01:17

I deinstalled perl, PDK,& .Net v3.5, installed .Net3.5, 32bit Perl and 32bit PDK:

This is perl 5, version 22, subversion 2 (v5.22.2) built for MSWin32-x86-multi-t
hread-64int
(with 1 registered patch, see perl -V for more detail)

PerlNET 9.5.1 build 300018
Copyright (C) 1998-2016 ActiveState Software Inc. All rights reserved.

But I get the same error using the WSUS assembly.

grahams
ActiveState Staff
Mon, 2016-08-15 08:54

Installation order is very important. If you do not have .NET 3.5 installed before the PDK installer ran, you cannot add .NET 3.5 and make things work later. PerlDev Kit needs to be uninstalled, and then re-installed with .NET libraries in place.

Technically, PerlNET is not even .NET 3.5 compatible. It can only use functions from .NET 2.0 and older, so there are parts of the 3.5 library which are unusable.
-And-
Wrapped dll files built with PerlNET are known to be unusable with .NET apps built using frameworks that are 4.5 or higher.

ska | Tue, 2016-08-16 01:20

I re-installed in the order you mentioned, but I cannot use the assembly.

So it looks like, the .Net v4.0.0.0 assembly is out of reach for PerlNet.