Skip to content

Missing RID for "Windows, Any CPU" configuration #18098

Closed

Description

@atauenis

Visual Studio can build .NET Core apps for "Any CPU" platform (combo 32/64-bit). How to build/publish an app like Visual Studio does but using dotnet publish -r tool? Which RID I need to use?


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Activity

  1. tdykstra commented on Apr 27, 2020

    @tdykstra
    Contributor

    @sfoslund can you help with this question?

  2. added
    waiting-on-feedback
    and removed
    ⌚ Not Triaged
    on Apr 27, 2020
  3. sfoslund commented on Apr 27, 2020

    @sfoslund
    Member

    The -r flag is not required and by default dotnet publish produces a cross platform dll. See the first example in the publishing documentation.

  4. atauenis commented on Apr 27, 2020

    @atauenis
    Author

    No, I'm interested in a EXE file that launches the DLL. E.g. like from dotnet publish -r win-x86, but with "win-AnyCPU" platform (if it is available in Core 3.1 like was in Framework 4.x).

    Or win-x64 builds can be runned on 32-bit systems?

  5. sfoslund commented on Apr 27, 2020

    @sfoslund
    Member

    I see, since EXE files are executables and inherently not cross platform, I don't think there's a way to do this.

  6. atauenis commented on Apr 28, 2020

    @atauenis
    Author

    https://stackoverflow.com/questions/516730/what-does-the-visual-studio-any-cpu-target-mean

    Visual C# 2005+ can make semi cross-platform binaries. Executables for "Any CPU" platform are running in 32-bit mode on 32-bit OS and in native 64-bit mode in 64-bit OS.

  7. sfoslund commented on Apr 28, 2020

    @sfoslund
    Member

    In the stack overflow post you linked, this is the most liked answer:

    An AnyCPU assembly will JIT to 64-bit code when loaded into a 64-bit process and 32 bit when loaded into a 32-bit process.

    I believe the AnyCPU assembly it's referring to are DLLs, which are taken and JIT (just in time) compiled to native code (64 bit on 64 bit OSs and 32 bit on 32).

  8. atauenis commented on May 12, 2020

    @atauenis
    Author

    https://stackoverflow.com/questions/61711209/how-to-compile-a-net-core-project-to-any-cpu-architecture

    dotnet/sdk#1906 (comment)

    Seems that .NET Core have very bad support for AnyCPU EXEs. Sad... Clients of my app reported that 32-bit EXE don't run with 64-bit Runtime, so they're need to install both architectures of Runtime to use all .NET Core apps on their machines. Older versions of my app, built via Visual Studio (not CLI) in AnyCPU mode, are working correctly in all x86 and x64 systems with a single Runtime been installed.

  9. tdykstra commented on May 12, 2020

    @tdykstra
    Contributor

    Per the dotnet/sdk#1906 (comment) issue, it doesn't appear that there is anything missing in the RID catalog doc, so I'm closing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ⌚ Not Triagedwaiting-on-feedback

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions