In all of the component projects of my C# solution, "Platform target" is set x64 in Project>Properties>Build. However, the Platform property is still "Active (Any CPU") and that is the only option. In the build log, I can see that it is copying both x64 and x86 versions of some nuget packages. Two questions:
The Platform target under Project>Properties>Build
is not the right option for your build process. That option is to tell which platform the project assembly is compiled for rather than your nuget package. So, the option cannot change the build platform and your nuget package still uses the build platform to judge which version of the dll is copied into the main project output folder.
More info you can refer to this document.
Suggestion
You can use Configuration Manager under Build
You should locate your Project and then choose x64
to build your Project Platform. And if you did not have x64
, you have to click New to create it.
Update 1
Your Build Configuration is in a mess. So please first enter each project Properties-->Build--> change Platform target
to Any CPU
to do a restore operation.
Then, enter your Configuration Manager, delete any x64
and x86
platform under Active Solution Platform and Project Platform if you have. Then, click Active Solution Platform and then create a new x64
platform.
This will set uniform platform settings for each project.
You can refer to this similar issue.