我们如何在 Azure Devops 中设置构建/发布管道以自动将 .NET Core 3.1 项目部署为 Web 作业?
我在门户中手动创建了一个 Web 应用程序:
我正在尝试使用 Azure Devops 部署以下项目:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\BusinessManager\BusinessManager.csproj" />
<ProjectReference Include="..\Models\Models.csproj" />
<ProjectReference Include="..\Service\Service.csproj" />
</ItemGroup>
</Project>
这是我的构建任务
dotnet build
任务详情:
dotnet publish
任务详情:
我在构建中遇到以下错误
C:\Program Files\dotnet\sdk\9.0.101\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.ConflictResolution.targets(112,5): error NETSDK1152: Found multiple publish output files with the same relative path: D:\a\1\s\Controller.Tests\appsettings.json, D:\a\1\s\API\appsettings.json. [D:\a\1\s\Controller.Tests\Controller.Tests.csproj]
##[error]Error: The process 'C:\Program Files\dotnet\dotnet.exe' failed with exit code 1
##[warning].NET 5 has some compatibility issues with older Nuget versions(<=5.7), so if you are using an older Nuget version(and not dotnet cli) to restore, then the dotnet cli commands (e.g. dotnet build) which rely on such restored packages might fail. To mitigate such error, you can either: (1) - Use dotnet cli to restore, (2) - Use Nuget version 5.8 to restore, (3) - Use global.json using an older sdk version(<=3) to build
Info: Azure Pipelines hosted agents have been updated and now contain .Net 5.x SDK/Runtime along with the older .Net Core version which are currently lts. Unless you have locked down a SDK version for your project(s), 5.x SDK might be picked up which might have breaking behavior as compared to previous versions. You can learn more about the breaking changes here: https://docs.microsoft.com/en-us/dotnet/core/tools/ and https://docs.microsoft.com/en-us/dotnet/core/compatibility/ . To learn about more such changes and troubleshoot, refer here: https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/build/dotnet-core-cli?view=azure-devops#troubleshooting
##[error]Dotnet command failed with non-zero exit code on the following projects : [ '' ]
Finishing: dotnet publish
禁用
dotnet publish
并启用工件掉落时,构建成功:
构建工件发布后触发发布:
但是,我没有看到门户中发布的网络作业
问题