.NET 5 MVC - 使用带有 .publishsettings 文件的 dotnet CLI 从 linux 发布项目

.NET 5 MVC - Publish project from linux using dotnet CLI with .publishsettings file

我已经完成了我的 .net 5 mvc 应用程序,我想将它放在“webio.pl”共享主机上。我知道如何在 windows 到 visual studio 上执行此操作,但在 linux 上,我只有 dotnet cli。我已经从服务器管理面板下载了 .publishsettings 文件,但不知道如何正确使用“dotnet publish”命令。我知道这可能是一个愚蠢的问题,但任何帮助表示赞赏。文件包含标签,标签中包含用户名、msdeploySite 等属性。

好像这不可能?

https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/visual-studio-publish-profiles?view=aspnetcore-6.0#publish-to-an-msdeploy-endpoint-from-the-command-line 说:

The dotnet msbuild command is a cross-platform command and can compile ASP.NET Core apps on macOS and Linux. However, MSBuild on macOS and Linux isn't capable of deploying an app to Azure or other MSDeploy endpoints.

但它也表示如果它确实有效,命令将如下所示:

dotnet msbuild "AzureWebApp.csproj"
    /p:DeployOnBuild=true 
    /p:PublishProfile="AzureWebApp - Web Deploy" 
    /p:Username="$AzureWebApp" 
    /p:Password=".........."

但是您必须自己从 .publishsettings xml 文件中找出 属性 名称和值。