Click here to Skip to main content
15,888,351 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I'm encountering the error ".dll targeting 'AMD64' is not compatible with the project's target platform 'x86'" while building my project in visual studio 2019.

What I have tried:

Switched project target platform to x64 (if applicable).
Cleaned and rebuilt the project thoroughly.
Posted
Updated 3-Apr-24 0:07am

First thing - try to run the project using Any CPU. See if that fixes it for you. If it doesn't, you will need to create an AMD64 specific configuration.

From the menu, select Build > Configuration Manager. Select the Active Solution Platform dropdown and click New... You can set up a new configuration now. In the New Solution Platform dialog select ARM64, and Copy Settings from Any CPU.
 
Share this answer
 
To add to what Pete has said, x86 projects build for a 32 bit OS, while AMD64 are built for a 64 bit environment - you can't combine the two in a single executable as the CPU can't be switched between them at run time.

So if you want to use a 64 bit DLL, you must build your whole project as 64 bit, or as "Any CPU" - but the later may cause problems if you try to load a non-.NET 64 bit DLL in a .NET EXE file at run time.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900