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

[Bug]: Container Build error on .NET 6.0.29 and .NET SDK 6.0.421 #10069

Open
christian-eaton opened this issue Apr 24, 2024 · 2 comments
Open
Assignees
Labels

Comments

@christian-eaton
Copy link

christian-eaton commented Apr 24, 2024

Issue Description

We are attempting to build with a self hosted agent. The Host OS for the Build Server is Windows Server 2022 Data Center - Azure Edition. We are using Docker CE on the build server. Our project does contain a resx file. we get the following:
C:\Program Files\dotnet\sdk\6.0.421\Microsoft.Common.CurrentVersion.targets(3262,5): error MSB4018: The "GenerateResource" task failed unexpectedly. [C:\src\NID.TestDeploy\NID.TestDeploy.csproj]
C:\Program Files\dotnet\sdk\6.0.421\Microsoft.Common.CurrentVersion.targets(3262,5): error MSB4018: System.Runtime.InteropServices.COMException (0x80040154): Retrieving the COM class factory for component with CLSID {7B8A2D94-0AC9-11D1-896C-00C04FB6BFC4} failed due to the following error: 80040154 Class not registered (0x80040154 (REGDB_E_CLASSNOTREG)). [C:\src\NID.TestDeploy\NID.TestDeploy.csproj]
C:\Program Files\dotnet\sdk\6.0.421\Microsoft.Common.CurrentVersion.targets(3262,5): error MSB4018: at System.RuntimeTypeHandle.AllocateComObject(Void* pClassFactory) [C:\src\NID.TestDeploy\NID.TestDeploy.csproj]
C:\Program Files\dotnet\sdk\6.0.421\Microsoft.Common.CurrentVersion.targets(3262,5): error MSB4018: at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean wrapExceptions) [C:\src\NID.TestDeploy\NID.TestDeploy.csproj]
C:\Program Files\dotnet\sdk\6.0.421\Microsoft.Common.CurrentVersion.targets(3262,5): error MSB4018: at Microsoft.Build.Tasks.GenerateResource.IsDangerous(String filename) [C:\src\NID.TestDeploy\NID.TestDeploy.csproj]
C:\Program Files\dotnet\sdk\6.0.421\Microsoft.Common.CurrentVersion.targets(3262,5): error MSB4018: at Microsoft.Build.Tasks.GenerateResource.Execute() [C:\src\NID.TestDeploy\NID.TestDeploy.csproj]
C:\Program Files\dotnet\sdk\6.0.421\Microsoft.Common.CurrentVersion.targets(3262,5): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() [C:\src\NID.TestDeploy\NID.TestDeploy.csproj]
C:\Program Files\dotnet\sdk\6.0.421\Microsoft.Common.CurrentVersion.targets(3262,5): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask) [C:\src\NID.TestDeploy\NID.TestDeploy.csproj]

I checked the file system and urlmon.dll does exist. I checked the registry and it is registered.

The following is a simple test project that reproduces the issue.
NID.TestDeploy.zip

Steps to Reproduce

Setup a Windows Server 2022 Datacenter Azure Edition as a self hosted agent for Azure DevOps. Install and Configure Docker CE.
Install-Module -Name DockerMsftProvider -Repository PSGallery -Force
Prepare Windows operating system containers | Microsoft Learn
Configure Docker in Windows | Microsoft Learn
Be sure to add the user that the Azure Devops Agent service is running as to a local windows group and add the group to the 'group' section of the daemon.json at C:\ProgramData\docker\config. Install Visual Studio 2022 build tools. Create a pipeline in Azure Devops. Run the pipeline.

Expected Behavior

Expect for the container to be built.

Actual Behavior

Build fails with the following:
C:\Program Files\dotnet\sdk\6.0.421\Microsoft.Common.CurrentVersion.targets(3262,5): error MSB4018: The "GenerateResource" task failed unexpectedly. [C:\src\NID.TestDeploy\NID.TestDeploy.csproj]
C:\Program Files\dotnet\sdk\6.0.421\Microsoft.Common.CurrentVersion.targets(3262,5): error MSB4018: System.Runtime.InteropServices.COMException (0x80040154): Retrieving the COM class factory for component with CLSID {7B8A2D94-0AC9-11D1-896C-00C04FB6BFC4} failed due to the following error: 80040154 Class not registered (0x80040154 (REGDB_E_CLASSNOTREG)). [C:\src\NID.TestDeploy\NID.TestDeploy.csproj]
C:\Program Files\dotnet\sdk\6.0.421\Microsoft.Common.CurrentVersion.targets(3262,5): error MSB4018: at System.RuntimeTypeHandle.AllocateComObject(Void* pClassFactory) [C:\src\NID.TestDeploy\NID.TestDeploy.csproj]
C:\Program Files\dotnet\sdk\6.0.421\Microsoft.Common.CurrentVersion.targets(3262,5): error MSB4018: at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean wrapExceptions) [C:\src\NID.TestDeploy\NID.TestDeploy.csproj]
C:\Program Files\dotnet\sdk\6.0.421\Microsoft.Common.CurrentVersion.targets(3262,5): error MSB4018: at Microsoft.Build.Tasks.GenerateResource.IsDangerous(String filename) [C:\src\NID.TestDeploy\NID.TestDeploy.csproj]
C:\Program Files\dotnet\sdk\6.0.421\Microsoft.Common.CurrentVersion.targets(3262,5): error MSB4018: at Microsoft.Build.Tasks.GenerateResource.Execute() [C:\src\NID.TestDeploy\NID.TestDeploy.csproj]
C:\Program Files\dotnet\sdk\6.0.421\Microsoft.Common.CurrentVersion.targets(3262,5): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() [C:\src\NID.TestDeploy\NID.TestDeploy.csproj]
C:\Program Files\dotnet\sdk\6.0.421\Microsoft.Common.CurrentVersion.targets(3262,5): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask) [C:\src\NID.TestDeploy\NID.TestDeploy.csproj]

Analysis

No response

Versions & Configurations

MSBuild version 17.9.8+b34f75857 for .NET Framework
17.9.8.16306

@AR-May
Copy link
Member

AR-May commented Apr 30, 2024

team triage: @GangWang01 can you try to repro this?

@esfernandez
Copy link

esfernandez commented May 1, 2024

I have same problem. I am using Docker Desktop in Windows mode. At do "dotnet publish" (defined in dockerfile of service) using docker compose, the error happen. At do "dotnet build", where it succed a step back, not happen.

I am looking this file:

https://github.com/dotnet/msbuild/blob/main/src/Tasks/GenerateResource.cs

Maybe the question is how we can skip the calling to "IsDangerous" method.

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

No branches or pull requests

4 participants