In dotnet core/.net 5 is there the possibility to have a project that builds executable for x86 and x64?
An obvious option would be to work with two separate project files as suggested here: Build both x86 and x64 at.
Is there an alternative? Neither <PlatformTargets>x64;x86</PlatformTargets>
nor <RuntimeIdentifiers>win-x86;win-x64</RuntimeIdentifiers>
in .csproj file yield the desired result. I even tried with a publish-profile using<RuntimeIdentifiers>win-x64;win-x86</RuntimeIdentifiers>
which seems not to have the desired effect.
I would like to have both files as native items in the nuget package so I think it would be nice if I could do everything with just one project.
Update: I cannot use AnyCPU because it might be shipped as 32-bit bundle together with 32-bit native libraries. The AnyCPU might run as 64-bit then (there is no constraint the JIT could detect) and be incompatible with the native files and fail as a consequence.