actions / runner-images

GitHub Actions runner images
MIT License
10.02k stars 3.03k forks source link

ubuntu-latest: Failing to run NET6 app due to missing Microsoft.NETCore.App #10139

Closed sebastien-marichal closed 2 months ago

sebastien-marichal commented 3 months ago

Description

After the latest update in ubuntu-latest we started having issues in our Azure pipeline while running a NET6 app with the error:

/usr/share/dotnet/sdk/7.0.201/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(376,5):
error NETSDK1127: The targeting pack Microsoft.NETCore.App is not installed. Please restore and try again.

This time the issue seems to come from the update of .NET 8 update from 8.0.301 to 8.0.302.

Similar to issues we already reported in #5792, #6925 & #7319.

Platforms affected

Runner images affected

Image version and build link

Image: ubuntu-22.04 Version: 20240624.1.0

Is it regression?

Yes. The previous version was working correctly.

Expected behavior

Run the App without a runtime error.

Actual behavior

Following error:

/usr/share/dotnet/sdk/7.0.201/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(376,5):
error NETSDK1127: The targeting pack Microsoft.NETCore.App is not installed. Please restore and try again.

Repro steps

Could not reproduce this locally.

Changing the image to ubuntu-20.04 seems to solve the issue on the pipeline, at least.

hemanthmanga commented 3 months ago

@sebastien-marichal We are looking into the issue, we will get back to you after investigating this issue, Thanks.

kishorekumar-anchala commented 3 months ago

HI @sebastien-marichal ,

Please provide your comments for below to further investigation: 1) Which SDK version you're using locally ? 2) Can you please share your azure pipeline file ?

rajravat commented 3 months ago

We are also experiencing this issue too with a dotnet 8 project, for now we have also changed our ubuntu version to be 20.04

kishorekumar-anchala commented 3 months ago

We are also experiencing this issue too with a dotnet 8 project, for now we have also changed our ubuntu version to be 20.04

Could you please share the below details:

  1. Which SDK version you're using locally ?
  2. Can you please share your azure pipeline file ?
eholman commented 3 months ago

Ah, I see I've reported the same but for .NET 8... I think there is more information: #10147

kishorekumar-anchala commented 3 months ago

Hi @rajravat , @sebastien-marichal ,

Could you please try to run with MSBuild x64 architecture (VS Build task).

    clean: true
    msbuildArchitecture: 'x64'
rajravat commented 3 months ago

We are also experiencing this issue too with a dotnet 8 project, for now we have also changed our ubuntu version to be 20.04

Could you please share the below details:

  1. Which SDK version you're using locally ?
  2. Can you please share your azure pipeline file ?

Local SDK is 8.0.302

pipeline snippets as below:

note it only fails when using ubuntu-latest, using 20.04 works

azure-pipelines.yml image build.yml image fails on the "build tests" step with an error of

[error]/usr/share/dotnet/sdk/8.0.302/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(404,5): Error NETSDK1127: The targeting pack Microsoft.NETCore.App is not installed. Please restore and try again.

rajravat commented 3 months ago

Hi @rajravat , @sebastien-marichal ,

Could you please try to run with MSBuild x64 architecture (VS Build task).

    clean: true
    msbuildArchitecture: 'x64'

i tried it with the following flags and it still fails with the same error (i did have to add runtimeidentifiers to my projs after adding the arch flag)

- task: DotNetCoreCLI@2 displayName: Build Tests inputs: command: build arguments: --no-incremental --arch x64 --configuration $(buildConfiguration) --no-restore

2024-07-02T06:47:00.4178049Z ##[section]Starting: Build Tests 2024-07-02T06:47:00.4184695Z ============================================================================== 2024-07-02T06:47:00.4184823Z Task : .NET Core 2024-07-02T06:47:00.4184877Z Description : Build, test, package, or publish a dotnet application, or run a custom dotnet command 2024-07-02T06:47:00.4184978Z Version : 2.240.0 2024-07-02T06:47:00.4185029Z Author : Microsoft Corporation 2024-07-02T06:47:00.4185293Z Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/build/dotnet-core-cli 2024-07-02T06:47:00.4185388Z ============================================================================== 2024-07-02T06:47:01.0001297Z Info: .NET Core SDK/runtime 2.2 and 3.0 are now End of Life(EOL) and have been removed from all hosted agents. If you're using these SDK/runtimes on hosted agents, kindly upgrade to newer versions which are not EOL, or else use UseDotNet task to install the required version. 2024-07-02T06:47:01.0061874Z [command]/usr/bin/dotnet build -dl:CentralLogger,"/home/vsts/work/_tasks/DotNetCoreCLI_5541a522-603c-47ad-91fc-a4b1d163081b/2.240.0/dotnet-build-helpers/Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll"*ForwardingLogger,"/home/vsts/work/_tasks/DotNetCoreCLI_5541a522-603c-47ad-91fc-a4b1d163081b/2.240.0/dotnet-build-helpers/Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll" --no-incremental --arch x64 --configuration Release --no-restore 2024-07-02T06:47:09.5931133Z ##[error]/usr/share/dotnet/sdk/8.0.302/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(404,5): Error NETSDK1127: The targeting pack Microsoft.NETCore.App is not installed. Please restore and try again. 2024-07-02T06:47:09.5940479Z /usr/share/dotnet/sdk/8.0.302/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(404,5): error NETSDK1127: The targeting pack Microsoft.NETCore.App is not installed. Please restore and try again. [/home/vsts/work/1/s/Phoenix.Quotation.Contracts/Phoenix.Quotation.Contracts.csproj] 2024-07-02T06:47:09.5943925Z ##[error]/usr/share/dotnet/sdk/8.0.302/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(404,5): Error NETSDK1127: The targeting pack Microsoft.NETCore.App is not installed. Please restore and try again. 2024-07-02T06:47:09.5945285Z /usr/share/dotnet/sdk/8.0.302/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(404,5): error NETSDK1127: The targeting pack Microsoft.NETCore.App is not installed. Please restore and try again. [/home/vsts/work/1/s/Phoenix.Quotation.Domain/Phoenix.Quotation.Domain.csproj] 2024-07-02T06:47:10.4291618Z 2024-07-02T06:47:10.4292460Z Build FAILED. 2024-07-02T06:47:10.4293815Z 2024-07-02T06:47:10.4294301Z /usr/share/dotnet/sdk/8.0.302/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(404,5): error NETSDK1127: The targeting pack Microsoft.NETCore.App is not installed. Please restore and try again. [/home/vsts/work/1/s/Phoenix.Quotation.Contracts/Phoenix.Quotation.Contracts.csproj] 2024-07-02T06:47:10.4294982Z /usr/share/dotnet/sdk/8.0.302/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(404,5): error NETSDK1127: The targeting pack Microsoft.NETCore.App is not installed. Please restore and try again. [/home/vsts/work/1/s/Phoenix.Quotation.Domain/Phoenix.Quotation.Domain.csproj] 2024-07-02T06:47:10.4295582Z 0 Warning(s) 2024-07-02T06:47:10.4298010Z 2 Error(s) 2024-07-02T06:47:10.4298290Z 2024-07-02T06:47:10.4392542Z Time Elapsed 00:00:03.72 2024-07-02T06:47:10.5564136Z ##[error]Error: The process '/usr/bin/dotnet' failed with exit code 1 2024-07-02T06:47:10.5566187Z ##[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 2024-07-02T06:47:10.5589768Z 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 2024-07-02T06:47:10.5593718Z ##[error]Dotnet command failed with non-zero exit code on the following projects : [ '' ] 2024-07-02T06:47:10.5741677Z ##[section]Finishing: Build Tests

eholman commented 3 months ago

Like I've also mentioned in #10147 - The exact same pipeline, only setting the vmimage to windows-latest, works without any errors. Can you elaborate on the suggestion to update the Restore task? What was the expected outcome of this change?

kishorekumar-anchala commented 3 months ago

Like I've also mentioned in #10147 - The exact same pipeline, only setting the vmimage to windows-latest, works without any errors. Can you elaborate on the suggestion to update the Restore task? What was the expected outcome of this change?

Hi @eholman , Started investigation on the same , i will provide details once investigation completed.

eholman commented 3 months ago

Setting vmimage to ubuntu-20.04 seems to work too

kishorekumar-anchala commented 3 months ago

Hi @eholman , @rajravat ,

Could you please try to run by adding below task (first task) , it is worked for me for dotnet 8.0.302 .

Note : Change according to your version.


- task: UseDotNet@2
  inputs:
    packageType: 'sdk'
    version: '8.x' # or 8.0.302 
    installationPath: $(Agent.ToolsDirectory)/dotnet 
rajravat commented 3 months ago

This does fix the problem for me when using ubuntu-latest, thanks.

Will this be "fixed" in a future image revision for ubuntu or is the expectation now that we keep this task there permanently?

kishorekumar-anchala commented 3 months ago

Hey @rajravat ,

This does fix the problem for me when using ubuntu-latest, thanks.

Thanks for confirmation !

Will this be "fixed" in a future image revision for ubuntu or is the expectation now that we keep this task there permanently?

It depends on new version upgrades and patches on images , some have older versions and some have new . But i can confirm that the given task will always help us to prevent such issues , it will pin the version which is needed for your project ( if that version will installed on images) . So keep that task in your pipeline permanently (Not needed for some images) .

@eholman , @sebastien-marichal - I hope the above workaround fix your issue. Kindly provide your comments .

Thank you !

kishorekumar-anchala commented 3 months ago

Hi @eholman @sebastien-marichal ,

Could you please provide your status ?

eholman commented 3 months ago

The workaround works, thank you. But I definitely consider this a workaround because switching between vmImages should not cause this kind of issues, specifically when the same runner image versions are used, imho. I'd rather consider this as regression because it worked perfectly fine before and without any reason it fails (at least for us, the users). There should be at least some breaking changes noted somewhere in release notes.

kishorekumar-anchala commented 3 months ago

Hi @eholman ,

Currently we don't have any information on it , however, we will work on it, and we'll let you know once we find a solution.

@sebastien-marichal , Could you please provide your comments ?

kishorekumar-anchala commented 2 months ago

Hi @sebastien-marichal , We have attempted to follow up regarding your response. We hope the issue has been resolved with above workaround . We are now closing the case. Thank you.

sebastien-marichal commented 2 months ago

I confirm that the issue is resolved for us as well. Thank you!