-1

I have a dependency on an unmanaged dll. I can compile the unmanaged dll in both x86 and x64.

I want to add my project both the x64 and x86 dlls, so it could dynamically choose between the x64 or x86 dlls depend on the system environment execution.

I know I can have to releases, one as x64 and one as x86, but I would rather it to behave like an AnyCpu single dll.

Edit1:

I don't want to user [DllImport] attribute. I'm searching for a more elegant way to do so.

Cœur
  • 37,241
  • 25
  • 195
  • 267
Yogev
  • 141
  • 4
  • 14

1 Answers1

1

As soon as you have a dependency on native DLLs you will need to have separate build configurations for each CPU architecture. The AnyCPU target can only be used when you only depend on managed assemblies.

Rowland Shaw
  • 37,700
  • 14
  • 97
  • 166