I have a .Net 6 application that had to set platform to x86 to load c++ DLL. The application references many of other .Net 6 class library projects, along with Serilog, EF, and other nuget packages.
Will having to set the application platform to x86 cause issues with the nuget packages used and other .Net 6 class libraries it references at runtime?
Not sure what do because expertise is not in the field of the problem
Asked
Active
Viewed 18 times
0

steve
- 11
1 Answers
0
The answer depends on which bitness modes are supported by other dependencies. The problem will only be if you will have dependency with x64-only native library used.
- If all your dependencies are pure managed (.net) then everything will be fine.
- If there is a dependency that uses some native/unmanaged dlls and it package contains the code to handle the x86/x64 modes correctly (e.g. to load different dlls for each mode), then all will be fine.
- If there is a dependency that uses some native/unmanaged dlls and the only x86 version of the dll exists, then again all will be fine.
- Finally, if there is a dependency that uses some native/unmanaged dlls and the only x64 version of the dll exists, then that dependency will fail to load the dll and will probably break the application.
And even with x64-only dependencies in some particular case you still can make all of this together by offloading the dependencies of different bitnesses into the separate process, as described here 64bit C# .Net Wrapper for 32bit C# .Net DLL

Serg
- 3,454
- 2
- 13
- 17