How do we set up build/release pipelines in Azure Devops to automatically deploy a .NET Core 3.1 project as a webjob?
I manually created a web app in the portal:
I'm attempting to deploy the following project using 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>
Here are my build tasks
dotnet build
task details:
dotnet publish
task details:
I'm getting the following error from the build
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
When disabling the dotnet publish
and enabling the artifact drop, the build succeeds:
The release is triggered after the build artifacts are published:
However, I do not see the web job published in the portal
Questions
I was able to build using yaml without having to upgrade anything and it released fine and works in portal.
According to your comment, you are able to build using YAML, but it didn't work when you used the classic pipeline.
Usually, as long as the same configuration is used in both YAML and the classic pipeline, the running results should be the same. In this case, you can export your classic pipeline to YAML and compare the differences between the exported YAML and your original YAML.
Steps:
Select your classic pipeline definition.
Click the ellipses icon (three dots) and select "Export to YAML." Make sure you're in the pipeline definition view, not a specific run, to see the "Export to YAML" option.
Open the downloaded YAML file in your code editor.
Compare the downloaded YAML file with your original YAML file to identify any differences.
Make the appropriate changes to your classic pipeline based on the comparison.
Run the modified classic pipeline and check the result.