Exploring bitbucket pipeline to create a CI/CD for a .net 5.0 microservice project. Please find the .yml file below
pipelines:
branches:
POR-2191:
- step:
name: Build MicroService
caches:
- dotnetcore
image: mcr.microsoft.com/dotnet/sdk:5.0
script:
- export PROJECT_NAME=MyProjectName
- dotnet restore
- dotnet build $PROJECT_NAME
But I am seeing this error when the pipeline runs,
Error:
+ dotnet build $PROJECT_NAME
Microsoft (R) Build Engine version 16.11.2+f32259642 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.
Determining projects to restore...
Restored /tmp/10vu21df.v2w/WorkerExtensions.csproj (in 1.42 sec).
WorkerExtensions -> /tmp/10vu21df.v2w/buildout/Microsoft.Azure.Functions.Worker.Extensions.dll
/root/.nuget/packages/microsoft.net.sdk.functions/3.0.11/build/Microsoft.NET.Sdk.Functions.Build.targets(32,5): error : It was not possible to find any compatible framework version [/tmp/10vu21df.v2w/WorkerExtensions.csproj]
/root/.nuget/packages/microsoft.net.sdk.functions/3.0.11/build/Microsoft.NET.Sdk.Functions.Build.targets(32,5): error : The framework 'Microsoft.NETCore.App', version '3.1.0' was not found. [/tmp/10vu21df.v2w/WorkerExtensions.csproj]
/root/.nuget/packages/microsoft.net.sdk.functions/3.0.11/build/Microsoft.NET.Sdk.Functions.Build.targets(32,5): error : - The following frameworks were found: [/tmp/10vu21df.v2w/WorkerExtensions.csproj]
/root/.nuget/packages/microsoft.net.sdk.functions/3.0.11/build/Microsoft.NET.Sdk.Functions.Build.targets(32,5): error : 5.0.12 at [/usr/share/dotnet/shared/Microsoft.NETCore.App] [/tmp/10vu21df.v2w/WorkerExtensions.csproj]
/root/.nuget/packages/microsoft.net.sdk.functions/3.0.11/build/Microsoft.NET.Sdk.Functions.Build.targets(32,5): error : [/tmp/10vu21df.v2w/WorkerExtensions.csproj]
/root/.nuget/packages/microsoft.net.sdk.functions/3.0.11/build/Microsoft.NET.Sdk.Functions.Build.targets(32,5): error : You can resolve the problem by installing the specified framework and/or SDK. [/tmp/10vu21df.v2w/WorkerExtensions.csproj]
/root/.nuget/packages/microsoft.net.sdk.functions/3.0.11/build/Microsoft.NET.Sdk.Functions.Build.targets(32,5): error : [/tmp/10vu21df.v2w/WorkerExtensions.csproj]
/root/.nuget/packages/microsoft.net.sdk.functions/3.0.11/build/Microsoft.NET.Sdk.Functions.Build.targets(32,5): error : The specified framework can be found at: [/tmp/10vu21df.v2w/WorkerExtensions.csproj]
/root/.nuget/packages/microsoft.net.sdk.functions/3.0.11/build/Microsoft.NET.Sdk.Functions.Build.targets(32,5): error : - https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=3.1.0&arch=x64&rid=debian.10-x64 [/tmp/10vu21df.v2w/WorkerExtensions.csproj]
/root/.nuget/packages/microsoft.net.sdk.functions/3.0.11/build/Microsoft.NET.Sdk.Functions.Build.targets(32,5): error : [/tmp/10vu21df.v2w/WorkerExtensions.csproj]
/root/.nuget/packages/microsoft.net.sdk.functions/3.0.11/build/Microsoft.NET.Sdk.Functions.Build.targets(32,5): error : Metadata generation failed. [/tmp/10vu21df.v2w/WorkerExtensions.csproj]
Build FAILED.
definitions:
services:
sdk:
image: mcr.microsoft.com/dotnet/core/sdk:3.1
Hi @[deleted] ,
We also encountered this issue, and the current work around the adapted is to use dotnet-install.sh script to install another version of dotnet sdk in the script.
Before you run dotnet restore and build, run below script to download dotnet-install.sh and use it to download and install sdk version 3.1.
- curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin -Channel 3.1 -Runtime dotnet -InstallDir /usr/share/dotnet
Hope this helps.
This helped me. Thanks, @Andy Jiang !
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.