Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pipeline - Error MSB4018: The "ApplyCompressionNegotiation" task failed unexpectedly. on Build windows-2022 version 20241113.3.0 #10995

Closed
2 of 15 tasks
gadjio opened this issue Nov 18, 2024 · 2 comments

Comments

@gadjio
Copy link

gadjio commented Nov 18, 2024

Description

Was working fine with image
Image: windows-2022
Version: 20241021.1.0
Included Software: https://github.com/actions/runner-images/blob/win22/20241021.1/images/windows/Windows2022-Readme.md
Image Release: https://github.com/actions/runner-images/releases/tag/win22%2F20241021.1

And stop working with image
Image: windows-2022
Version: 20241113.3.0
Included Software: https://github.com/actions/runner-images/blob/win22/20241113.3/images/windows/Windows2022-Readme.md
Image Release: https://github.com/actions/runner-images/releases/tag/win22%2F20241113.3

The code was the exact same an it just stop building with this error:

##[error]C:\Program Files\dotnet\sdk\9.0.100\Sdks\Microsoft.NET.Sdk.StaticWebAssets\targets\Microsoft.NET.Sdk.StaticWebAssets.Compression.targets(241,5): Error MSB4018: The "ApplyCompressionNegotiation" task failed unexpectedly.

System.ArgumentException: An item with the same key has already been added.
   at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
   at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)
   at Microsoft.AspNetCore.StaticWebAssets.Tasks.ApplyCompressionNegotiation.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder. <ExecuteInstantiatedTask>d__26.MoveNext()

It look like it's related to the Visual Studio Version (17.11 vs 17.12)

Would it be possible to have an image without DotNet 9?

Platforms affected

  • Azure DevOps
  • GitHub Actions - Standard Runners
  • GitHub Actions - Larger Runners

Runner images affected

  • Ubuntu 20.04
  • Ubuntu 22.04
  • Ubuntu 24.04
  • macOS 12
  • macOS 13
  • macOS 13 Arm64
  • macOS 14
  • macOS 14 Arm64
  • macOS 15
  • macOS 15 Arm64
  • Windows Server 2019
  • Windows Server 2022

Image version and build link

Image: windows-2022
Version: 20241113.3.0

Is it regression?

20241021.1.0

Expected behavior

Projects targeting .NET 8 (LTS) should continue to do so.

Actual behavior

Builds fails. Unable to use pipelines with DotNet8 - Blazor projects

Repro steps

dotnet/sdk#44784
dotnet/aspnetcore#57518

I was able to fix visual studio build task ( VSBuild@1) by specifying a stable SDK version in my global.json file. I set it to use .NET SDK 8.0.100, which bypassed the error completely.

for the DotNetCoreCli task ( DotNetCoreCLI@2) Im able to bypass it using

# Forces the pipeline agent to use the specified SDK version
- task: UseDotNet@2
  inputs:
    packageType: 'sdk'
    version: '8.0.100'
    installationPath: $(Agent.ToolsDirectory)/dotnet
  displayName: "Forces the pipeline agent to use the specified SDK version : 8.0.100"

But the problem persist when the blazor project have dependencies in DotNet Framework when using :

# Forces the pipeline agent to use the specified SDK version
- task: UseDotNet@2
  inputs:
    packageType: 'sdk'
    version: '8.0.100'
    installationPath: $(Agent.ToolsDirectory)/dotnet
  displayName: "Forces the pipeline agent to use the specified SDK version : 8.0.100"

- task: DotNetCoreCLI@2
  inputs:
    command: 'publish'
    publishWebProjects: false
    projects: '**/src/SSAMTA. BlazorApp/SSAMTA. BlazorApp.csproj'
    arguments: '--configuration Release --output $(Build.ArtifactStagingDirectory) /p:Version=$(myBuildNumber)'
    zipAfterPublish: True
  displayName: 'Build and Publish Blazor App'
@Prabhatkumar59
Copy link
Contributor

Hi @gadjio - Thank you for bringing this issue to our attention. We will look into this issue and will update you after investigating.

@RaviAkshintala
Copy link
Contributor

Hi @gadjio The new image version 20241125.1 has been rolled out. Please sync the main branch and try with the latest version. We are closing this issue, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants