Skip to content

When publishing how do I target specific .NET Core Runtimes? #8

@nicksterx

Description

@nicksterx

Topic
Target specific .NET Core Runtimes, specifically the win RID because that is the only platform I am targeting.

On my CI/CD server I publish my applications with this command:

dotnet publish -c Release -o ..\publish

It outputs a runtimes directory with the following sub-directories:

    - publish/runtimes/
       - debian.8-x64/
       - fedora.23-x64/
       - fedora.24-x64/
       - opensuse.13.2-x64/
       - opensuse.42.1-x64/
       - osx/
       - osx.10.10-x64/
       - rhel.7-x64/
       - ubuntu.14.04-x64/
       - ubuntu.16.04-x64/
       - ubuntu.16.10-x64/
       - unix/
       - win/ 

Is there a way to configure the project to only output the win runtime folder?

Scope
I only plan to publish this application on Windows 2016 Server so the OSX/Linux/Unix runtimes folders are not necessary. In several cases these runtimes folders contain known vulnerable dlls which lead to false positive OSA scans.

Why do i request this?
I have tried adding the win10-x64 and win10-x86 RIDs in the my project file's element:

<RuntimeIdentifiers>win10-x64;win10-x86</RuntimeIdentifiers>

The output of adding the RIDs to my csproj files is the same as if I did not specify the RIDs in those files.

When I run CI/CD command example

dotnet publish -c Release -r win10-x86 -o ..\publish

I believe it creates a self-contained deployment. As my publish directory goes from being 55MB to 120MB and from 237 files to 482 files. It also matches the output if I included the --self-contained flag.

Thank you for your time and help!

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions