如何从命令行发布.Net Core ASP便携版?

And*_*ent 5 c# msbuild jenkins .net-core

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

\n\n

我尝试使用命令:

\n\n
dotnet publish myapp.csproj --self-contained false --configuration Release --runtime ??? --output "\xd0\xa1:\\myapp"\n
Run Code Online (Sandbox Code Playgroud)\n\n

但运行时:“任何”、“便携式”不起作用。

\n\n

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

\n

Dan*_*iel 1

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

\n\n

例如

\n\n
dotnet publish myapp.csproj --self-contained false --configuration Release --runtime "alpine.3.7" --output "\xd0\xa1:\\myapp_alpine_3_7"\n\ndotnet publish myapp.csproj --self-contained false --configuration Release --runtime "linuxmint.19.2-x64" --output "\xd0\xa1:\\myapp_linuxmint_19_2_x64"\n
Run Code Online (Sandbox Code Playgroud)\n

  • 不。这不可能。您可以使用输出目录。我更新了答案。 (2认同)