One of the release management customer reported that while running a PS/DSC deployment script, the release management release is failing with following error:
Mixed mode assembly is built against version ‘v2.0.50727’ of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information.
Praneeth Yenugutala from the team investigated this and observed that it occurs because the support for side-by-side runtime from .NET 4.0 onwards has changed w.r.t. the way with which .NET assembly binds to older mixed-mode assemblies (example: – assemblies compiled from C++\CLI, directX assemblies etc). Since the process which carries the PS/DSC deployment in release management is built against .NET framework 4.5 older .NET mixed-mode binaries fail to load in our deployment context.
To get past this error till the actual fix is done in the product, you should not load such mixed-mode dll’s directly in the .ps1 script. You should launch a new process in .ps1 and load them in that context. Having this configuration block in the assembly’s app.config file(which is launched as a new process) should work:
Please try this out and do let us know in case it still does not work for you.