Unable to load assembly on XP 64bit
I have compiled a .NET application using Any CPU
option. This .NET application uses an unmanaged dll (managed wrapper) that encapsulated C++ calls. This .NET wrapper resid开发者_如何学Ces in GAC.
When I run the .NET application it runs fine on XP 32 bit. But when I run it on XP 64 bit, it fails and gives the following exception:
Could not load file or assembly "Dll name, version, Culture=neutral, PublicKeyToken" or one of its dependencies.
How do I resolve this?
You need to use the x86 CPU option. If you know that one of your unmanaged dependencies is 32bit then you need to build your solution with the x86 option for the CPU. This ensures that even on a 64bit operating system your application will be run in a 32 bit process.
This is required because its not possible to load 32 bit compiled code into a 64 bit process.
You need to make sure your unmanaged dll is also 64bit capable and within the search path.
You can find some explanation on Microsoft Connect website
精彩评论