How to target x86/x64/Any CPU in .Net Core

If you've written a .Net Core console app (RTM, though the tooling is still in Preview) you may have noticed that the GUI options to set your target output are missing.  Visual Studio seems to want to build the project to the architecture of the machine compiling the code.

There maybe instances where you need to deploy to a 32-bit server or would prefer AnyCPU or 64-bit.  To do this today you'll need to update the project.json file.  Inside of the buildOptions the important key/pair is platform.  From my project my entry looks like this:

      "buildOptions": {
        "emitEntryPoint": true,
        "preserveCompilationContext": true,
        "platform": "anycpu"

Leave a comment

Please note that we won't show your email to others, or use it for sending unwanted emails. We will only use it to render your Gravatar image and to validate you as a real person.