[英]Deploying .net core 3.1 web app to Azure Linux App Service
I've set up the release in Azure Devops to deploy a .net core 3.1 app to a Linux App Service in Azure.我已在 Azure Devops 中设置了该版本,以将 .net core 3.1 应用程序部署到 Azure 中的 Linux 应用服务。 This seems to push the code to Azure, but to a really weird path:
这似乎将代码推送到 Azure,但到了一条非常奇怪的路径:
Index of /wwwroot/Content/d_C/a/1/s/[MyProject]/obj/Release/netcoreapp3.1/PubTmp/Out/
/wwwroot/Content/d_C/a/1/s/[MyProject]/obj/Release/netcoreapp3.1/PubTmp/Out/
索引
This contains all the dlls and then a wwwroot directory which has all the files & folders found in my web project.这包含所有 dll,然后是一个 wwwroot 目录,其中包含在我的 Web 项目中找到的所有文件和文件夹。
Here is my Release set up .这是我的发布设置。 Anyone have any ideas why my release isn't publishing to /home/site/wwwroot/?
任何人都知道为什么我的版本没有发布到 /home/site/wwwroot/? Others have said that this is where the site should be published to.
其他人说这是网站应该发布到的地方。 Is there something I need to set up in the Azure portal or is this a Devops thing?
我需要在 Azure 门户中设置一些东西还是 Devops 的东西?
This wired path should not relevant with the configuration of Azure app service deploy task or Azure portal (Just ensure the Physical path
value in Azure portal is site/wwwroot
) .此有线路径不应与 Azure 应用服务部署任务或 Azure 门户的配置相关(只需确保Azure 门户中的
Physical path
值为site/wwwroot
) 。
I guess you were using Visual studio build task
to build your project, right?我猜您正在使用
Visual studio build task
来构建您的项目,对吗? Because I faced the similar path structure if I use VSbuild
task to build my .net core
app.因为如果我使用
VSbuild
任务来构建我的.net core
应用程序,我会面临类似的路径结构。 If yes, what the others told you is correct.如果是的话,其他人告诉你的是正确的。 This is the default action if you are using
Visual studio build task
in Build pipeline.如果您在构建管道中使用
Visual studio build task
,则这是默认操作。
Others have explained this in detail, also provided the corresponding solution.其他人对此进行了详细解释,也提供了相应的解决方案。 You can refer to this #1 for explanation of this default action.
您可以参考此#1以了解此默认操作的说明。 And check this #2 for work around.
并检查此#2以解决问题。
Therefore I can safely assume that you are developing ASP.NET Core 3.0 app to be hosted in Ubuntu.
因此,我可以放心地假设您正在开发要在 Ubuntu 中托管的 ASP.NET Core 3.0 应用程序。 Any .NET Core 3.0 (or later) application means that you should rely on the
dotnet build
instead of using VSBuild.任何 .NET Core 3.0(或更高版本)应用程序都意味着您应该依赖
dotnet build
而不是使用 VSBuild。Also you had stated that you will host the app on Ubuntu 18.x, then you should also run the build on Azure DevOps agent that runs on Ubuntu.
此外,您还表示您将在 Ubuntu 18.x 上托管应用程序,那么您还应该在 Ubuntu 上运行的 Azure DevOps 代理上运行构建。 This means you should only use
dotnet build
inDotNetCoreCLI@2
task, becauseVSBuild
task only runs on Windows based agent, not Ubuntu and it is intended to compile .NET Framework and other platform other than .NET Core.这意味着你应该只在
DotNetCoreCLI@2
任务中使用dotnet build
,因为VSBuild
任务只在基于 Windows 的代理上运行,而不是在 Ubuntu 上运行,它旨在编译 .NET Framework 和其他平台而不是 .NET Core。
So, to achieve what you want, here you need using dotnet build task to build your .net core 3.1
project.所以,为了实现你想要的,这里你需要使用dotnet build 任务来构建你的
.net core 3.1
项目。
- task: DotNetCoreCLI@2
displayName: Build
inputs:
command: 'build'
projects: PATH/TO/YOUR/Project.csproj
arguments: --output $(System.DefaultWorkingDirectory)/publish_output --configuration Release
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.