I have an ASP.NET MVC 4 project. I am referencing a managed C++ dll which internally calls methods of an unmanaged C++ dll. Problem is that I am getting "Could not load file or assembly or one of its dependencies" error when debugging my project in Visual Studio. The Dll it cannot find is used by the unmanaged C++ dll. I am placing all the required DLLs in the bin directory of ASP project.
Everything works fine in a WPF Project but I am getting error when doing the same thing in ASP.NET MVC4 project. Error comes on launching/debugging ASP.NET MVC4 project.
I have tried almost everything I could but not sure why this error is coming.
Ideas?
Edit I tried Fuslogvw.exe and it is creating two output/log file. I am a bit confused from its output
at one file it says at the end
Binding succeeds. Returns assembly from C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\9abdb93b\4655bb86\assembly\dl3\5113eba9\008d3984_ccb1cb01\Assembly.dll. LOG: Assembly is loaded in default load context."
In second log it says
=== Pre-bind state information ===
LOG: DisplayName = AssemblyName (Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: AssemblyName | Domain ID: 2
WRN: A partial bind occurs when only part of the assembly display name is provided.
WRN: This might result in the binder loading an incorrect assembly.
WRN: It is recommended to provide a fully specified textual identity for the assembly,
WRN: that consists of the simple name, version, culture, and public key token.
WRN: See whitepaper > http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue.
LOG: Appbase = file:///c:/users/haris.hasan/documents/visual studio 2012/Projects/MvcApplication1/MvcApplication1/
LOG: Initial PrivatePath = c:\users\haris.hasan\documents\visual studio 2012\Projects\MvcApplication1\MvcApplication1\bin
LOG: Dynamic Base = C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\9abdb93b LOG: Cache Base = C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\9abdb93b LOG: AppName = 4655bb86 Calling assembly : (Unknown). === WRN: No matching native image found.
LOG: IL assembly loaded from C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\9abdb93b\4655bb86\assembly\dl3\5113eba9\008d3984_ccb1cb01\AssemblyName.dll.
1- It can be because of MS C++ redistributable package updates! Uninstall them and reinstall again.
2- I think IIS is creating a shadow copy of each managed dll in a path but for unmanaged another path You have to configure that. Chek that link for more info.