Je référence un fichier exe dans une DLL. Lorsqu'il est exécuté en mode DEBUG tout fonctionne bien, mais lorsqu'il est exécuté en le mode de sortie ci-dessous exception est levéeSystem.BadImageFormatException s'est produite lors de la génération en mode de publication
System.BadImageFormatException occurred
HResult=-2147024885
Message=Could not load file or assembly 'Presensoft.InlineMarker, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.
Source=Presensoft.ApplicationServer
FileName=Presensoft.InlineMarker, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
FusionLog==== Pre-bind state information ===
LOG: DisplayName = Presensoft.InlineMarker, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
(Fully-specified)
LOG: Appbase = file:///F:/PresensoftNewTrunk/Trunk/Email Archiver/EmailService/Presensoft.ApplicationServerHost/bin/Release/
LOG: Initial PrivatePath = NULL
Calling assembly : Presensoft.ApplicationServer, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: F:\PresensoftNewTrunk\Trunk\Email Archiver\EmailService\Presensoft.ApplicationServerHost\bin\Release\Presensoft.ApplicationServerHost.vshost.exe.config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///F:/PresensoftNewTrunk/Trunk/Email Archiver/EmailService/Presensoft.ApplicationServerHost/bin/Release/Presensoft.InlineMarker.DLL.
LOG: Attempting download of new URL file:///F:/PresensoftNewTrunk/Trunk/Email Archiver/EmailService/Presensoft.ApplicationServerHost/bin/Release/Presensoft.InlineMarker/Presensoft.InlineMarker.DLL.
LOG: Attempting download of new URL file:///F:/PresensoftNewTrunk/Trunk/Email Archiver/EmailService/Presensoft.ApplicationServerHost/bin/Release/Presensoft.InlineMarker.EXE.
ERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated.
StackTrace:
at Presensoft.ApplicationServer.ExchangeServer2010Push.PostProcessingEmailsQueue()
at Presensoft.ApplicationServer.ExchangeServer2010Push.RunPushService(Guid appServerID) in f:\PresensoftNewTrunk\Trunk\Email Archiver\EmailService\Presensoft.ApplicationServer\ExchangeServer2010Push.cs:line 48
InnerException:
Je ne sais pas s'il y a un problème avec sondage fichier exe lors de l'exécution en mode RELEASE.
C'est probablement l'inverse. En supposant que OP a un processus de 64 bits et l'exe est de 32 bits seulement, vous obtenez ce problème lorsque DEBUG est réglé sur 32 bits, et RELEASE est réglé sur auto. –
J'avais vérifié les propriétés de chaque projet et elles étaient toutes identiques. Mais quand j'ai ouvert le gestionnaire de configuration, il y avait des différences dans le bitness. Merci!!! – Sameer
Je voulais juste noter. J'ai juste combattu cette erreur pendant des heures. Je n'ai fait aucun changement autre que l'installation de VS 2017, qui a bien fonctionné tout de suite après. J'utilise 2015. Je suis revenu après quelques heures et j'ai eu cette erreur. J'ai nettoyé la solution des tonnes de fois et reconstruit. Tard et à partir de TFS et enfin à l'improviste, il a commencé à travailler après avoir reçu le dernier pour la 10ème fois. Le dernier enregistrement était à moi. Je crois sérieusement qu'il y a un bug dans VS. – user3478586