Ashish Ashu
Ashish Ashu

Reputation: 14667

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 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

Answers (3)

leppie
leppie

Reputation: 117320

You need to make sure your unmanaged dll is also 64bit capable and within the search path.

Upvotes: 0

Bolek Tekielski
Bolek Tekielski

Reputation: 1214

You can find some explanation on Microsoft Connect website

Upvotes: -1

AnthonyWJones
AnthonyWJones

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

Related Questions