62
Views
4
Comments
There was an error validating the extension: System.BadImageFormatException:
Question
Hi,

I'm having problems publishing an extension, and I have this error:

There was an error validating the extension: System.BadImageFormatException: Could not load file or assembly 'file:///C:\Windows\TEMP\BuzgPCjSakWb1fxCjNaYNg\Source\NET\Bin\OutSystems.NssMicrosoftTranslatorAPI.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: 'file:///C:\Windows\TEMP\BuzgPCjSakWb1fxCjNaYNg\Source\NET\Bin\OutSystems.NssMicrosoftTranslatorAPI.dll'
at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.LoadFrom(String assemblyFile)
at OutSystems.HubEdition.ServerCommon.Extensions.ExtensionValidator.CheckExtensionConsistency(String temporaryXIFPath, String temporaryResourcesDirPath, String compoundTypesXml)

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].

I added the extension, can anyone help?

Thanks,
Pedro
 
MicrosoftTranslatorAPI.xif
2020-03-05 15-52-45
André Vieira
Staff
Hi Pedro,

Does the extension compile on Visual Studio? What is the target Framework?

Cheers
2015-09-28 00-04-44
Pedro Coelho
Hi André,

In Visual Studio I do not have errors and targer Framework is 3.5

Thanks

2012-03-16 12-21-09
João Rosado
Staff
Hi Pedro,

The error explicitly says "This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded". I checked and the dll inside the extension is actually built with .net 4.0, even though the project looks correctly configured.

To solve your problem try editing the MicrosoftTranslatorAPI.csproj final manually and change the ToolsVersion="2.0" to ToolsVersion="4.0"
This can be caused by a Visual Studio 2010 bug that creates assemblies in the wrong version. I mention it in this post, it's the "side-effect" of the warning CS1685 that I talk about.

Regards,
João Rosado



2015-09-28 00-04-44
Pedro Coelho
Hi João,

Your solution worked.

Thanks.
Pedro Coelho
 
Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.