私はC++でライブラリといくつかのDLLを使用するプロジェクトを持っています。私はそれを実行すると素晴らしい動作します。モジュールにアセンブリマニフェストが含まれていると予想されました
例外の詳細:
ライブラリがAwesomiumで、両方のライブラリとC#ラッパー
私は私のASP.NET MVC 4プロジェクトからこのプロジェクトへの参照を作成するときに、私は次のエラーを取得するC++含まれています。 System.BadImageFormatException:ファイルまたはアセンブリ 'file:/// D:\ Projects \ Development \ ProGamers \ GamingSite \ bin \ avcodec-52.dll'またはその依存関係の1つを読み込めませんでした。モジュールにアセンブリマニフェストが含まれていることが予想されました。私が試した
もの:
(ファイルが存在する)のdllを対処が、それはまだ動作しません。
GACに登録していますが、同じエラーが表示されています。
は
2 files with the same dll/exe name causing conflictの.NET Framework 4.0(およびないクライアントプロファイル)を使用していることを確認します - 私はそれを持っていけません。
Change the platform of the solution AnyCPU/Mixed Platforms
スタックトレース:
[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
[アセンブリバインディングログビューア](http://msdn.microsoft.com/en-us/library/e74a18c4.aspx)でバインドからログを取得できますか?最初にすべてのバインドをログに設定するように設定してください。 – rene
Assembly.LoadFrom()は、avcodec-52.dllのようなDLLでは動作できません。これは.NETアセンブリではありません。スニペットを投稿しないと、コードがこのように読み込もうとしている理由は完全には不明です。 –
Hans私はアセンブリを手動で使用しなかったし、コンソールアプリケーションでうまくいきました。それは、私がASP.NETアプリケーションから参照するときにのみ問題を引き起こします。 私が行っている唯一の使用は、Awesomium dllを参照することです。 http://awesomium.com –