Reputation: 14667
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 resides 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?
Upvotes: 1
Views: 380
Reputation: 117320
You need to make sure your unmanaged dll is also 64bit capable and within the search path.
Upvotes: 0
Reputation: 1214
You can find some explanation on Microsoft Connect website
Upvotes: -1
Reputation: 189505
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.
Upvotes: 3