首页 > 解决方案 > 如何从命令行发布 .Net Core ASP 便携版本?

问题描述

我需要为每个操作系统(win-32、win-64、Linux)构建 1 个版本。在 Visual Studio 中,您可以选择发布时间:依赖于框架和可移植。但我需要在 Jenkins 上做这件事。

我尝试使用命令:

dotnet publish myapp.csproj --self-contained false --configuration Release --runtime ??? --output "С:\myapp"

但运行时:“any”、“portable”不起作用。

VS如何构建依赖和可移植的params框架?我没有使用 MSBuild、dotnet build 或 dotnet MSBuild,因为发布命令添加了一些独特的文件(web.config、资源)并删除了无用的文件(dep*.json)。

标签: c#jenkins.net-coremsbuild

解决方案


你可以在这里找到所有运行时的列表runtime.json。取自.NET Core RID(运行时标识符目录)目录

例如

dotnet publish myapp.csproj --self-contained false --configuration Release --runtime "alpine.3.7" --output "С:\myapp_alpine_3_7"

dotnet publish myapp.csproj --self-contained false --configuration Release --runtime "linuxmint.19.2-x64" --output "С:\myapp_linuxmint_19_2_x64"

推荐阅读