x86/x64 The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)

1

Good morning,

I am developping a C# add-on to word, the first edition was compiled to run under office word x64, but now I have to run it under x86 version and I get this error when loadin the project in debug mode : The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047) Text of exception :

System.IO.FileLoadException: Impossible de charger le fichier ou l'assembly 'AppName, Version=1.0.0.0, Culture=neutral' ou une de ses dépendances. Le nom ou le code base de l'assembly donné n'est pas valide. (Exception de HRESULT : 0x80131047) Nom de fichier : 'AppName, Version=1.0.0.0, Culture=neutral' à System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) à System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) à System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection) à System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) à System.Reflection.Assembly.Load(String assemblyString) à Microsoft.VisualStudio.Tools.Office.Runtime.DomainCreator.ExecuteCustomization.CreateEntryPoint(String entryPointTypeName) à Microsoft.VisualStudio.Tools.Office.Runtime.DomainCreator.ExecuteCustomization.Microsoft.VisualStudio.Tools.Office.Runtime.Interop.IExecuteCustomization2.LoadEntryPoints(IntPtr serviceProvider)

I already checked my code, there is no quote...

I suspect a problem with folders GAC_32, GAC_64, GAC_MSIL

Any idea ?

c#
x86
64-bit
gac
asked on Stack Overflow Mar 3, 2017 by Julien G. • edited Mar 3, 2017 by Julien G.

1 Answer

2

The only way I found to solve this problem is to directly copy past the code in a new VSTO project in a x86 virtual machine. In this way I have been able to generate version x64,x86 and any processor !!

answered on Stack Overflow Mar 8, 2017 by Julien G.

User contributions licensed under CC BY-SA 3.0