Tengo un proyecto en C# que usa la biblioteca C++ y algunos dlls. Cuando lo ejecuto funciona bien.Se esperaba que el módulo contuviera un manifiesto de ensamblaje
La biblioteca es Awesomium, contiene biblioteca de C++ y C# envoltorios
Cuando creo referencia a este proyecto de mi proyecto ASP.NET MVC 4 me sale el siguiente error:
Detalles de la excepción: System.BadImageFormatException: No se pudo cargar el archivo o ensamblado 'file: /// D: \ Projects \ Development \ ProGamers \ GamingSite \ bin \ avcodec-52.dll' o una de sus dependencias. Se esperaba que el módulo incluyera un manifiesto de ensamblaje.
cosas que he intentado:
Hacer frente a las DLL, pero todavía no funciona (El archivo existe).
Registrando en el GAC pero tengo el mismo error allí.
Asegúrese de que el uso de .NET Framework 4.0 (y no el perfil del cliente)
2 files with the same dll/exe name causing conflict - Yo no lo tiene.
Change the platform of the solution AnyCPU/Mixed Platforms.
Seguimiento de la pila:
[BadImageFormatException: Could not load file or assembly 'file:///D:\Projects\Development\ProGamers\GamingSite\bin\avcodec-52.dll' or one of its dependencies. The module was expected to contain an assembly manifest.]
System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0
System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +34
System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +152
System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark) +102
System.Reflection.Assembly.LoadFrom(String assemblyFile) +34
WebActivator.ActivationManager.Run() +190
[InvalidOperationException: The pre-application start initialization method Run on type WebActivator.ActivationManager threw an exception with the following error message: Could not load file or assembly 'file:///D:\Projects\Development\ProGamers\GamingSite\bin\avcodec-52.dll' or one of its dependencies. The module was expected to contain an assembly manifest..]
System.Web.Compilation.BuildManager.InvokePreStartInitMethodsCore(ICollection`1 methods, Func`1 setHostingEnvironmentCultures) +550
System.Web.Compilation.BuildManager.InvokePreStartInitMethods(ICollection`1 methods) +132
System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath) +90
System.Web.Compilation.BuildManager.ExecutePreAppStart() +135
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +516
[HttpException (0x80004005): The pre-application start initialization method Run on type WebActivator.ActivationManager threw an exception with the following error message: Could not load file or assembly 'file:///D:\Projects\Development\ProGamers\GamingSite\bin\avcodec-52.dll' or one of its dependencies. The module was expected to contain an assembly manifest..]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9850940
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101
System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +456
¿Puede obtener un registro del enlace con el [Visor de registro de encuadernación de ensamblaje] (http://msdn.microsoft.com/en-us/library/e74a18c4.aspx)? Asegúrese de establecer primero la configuración en Log all binds. – rene
Assembly.LoadFrom() no puede funcionar en una DLL como avcodec-52.dll, no es un ensamblado .NET. El motivo por el que su código intenta cargarlo así no está del todo claro si no publica un fragmento. –
Hans No usé el ensamblaje manualmente, y funcionó muy bien en una aplicación de consola. Solo causa problemas cuando lo hago referencia desde mi aplicación ASP.NET. Y el único uso que estoy haciendo es hacer referencia a los dlls de Awesomium. http://awesomium.com –