msbuild: Windows container build error on .Net 6.0.8

My WebAPI project that contains an embedded RESX. The windows container build failed with the following error. This error started when using .Net 6.0.8 as base.

Step 12/18 : RUN dotnet build "WebAPI.csproj" -c Release -o /app/build
 ---> Running in 426a4e2a3a0e
MSBuild version 17.3.0+92e077650 for .NET
  Determining projects to restore...
  All projects are up-to-date for restore.
C:\Program Files\dotnet\sdk\6.0.400\Microsoft.Common.CurrentVersion.targets(3262,5): error MSB4018: The "GenerateResource" task failed unexpectedly. [C:\src\WebAPI\WebAPI.csproj]
C:\Program Files\dotnet\sdk\6.0.400\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\WebAPI\WebAPI.csproj]
C:\Program Files\dotnet\sdk\6.0.400\Microsoft.Common.CurrentVersion.targets(3262,5): error MSB4018:    at System.RuntimeTypeHandle.AllocateComObject(Void* pClassFactory) [C:\src\WebAPI\WebAPI.csproj]
C:\Program Files\dotnet\sdk\6.0.400\Microsoft.Common.CurrentVersion.targets(3262,5): error MSB4018:    at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean wrapExceptions) [C:\src\WebAPI\WebAPI.csproj]
C:\Program Files\dotnet\sdk\6.0.400\Microsoft.Common.CurrentVersion.targets(3262,5): error MSB4018:    at System.Activator.CreateInstance(Type type, Boolean nonPublic, Boolean wrapExceptions) [C:\src\WebAPI\WebAPI.csproj]
C:\Program Files\dotnet\sdk\6.0.400\Microsoft.Common.CurrentVersion.targets(3262,5): error MSB4018:    at System.Activator.CreateInstance(Type type) [C:\src\WebAPI\WebAPI.csproj]
C:\Program Files\dotnet\sdk\6.0.400\Microsoft.Common.CurrentVersion.targets(3262,5): error MSB4018:    at Microsoft.Build.Tasks.GenerateResource.IsDangerous(String filename) [C:\src\WebAPI\WebAPI.csproj]
C:\Program Files\dotnet\sdk\6.0.400\Microsoft.Common.CurrentVersion.targets(3262,5): error MSB4018:    at Microsoft.Build.Tasks.GenerateResource.Execute() [C:\src\WebAPI\WebAPI.csproj]
C:\Program Files\dotnet\sdk\6.0.400\Microsoft.Common.CurrentVersion.targets(3262,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() [C:\src\WebAPI\WebAPI.csproj]
C:\Program Files\dotnet\sdk\6.0.400\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\WebAPI\WebAPI.csproj]

Build FAILED

Docker file is attached. Dockerfile.txt .

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 5
  • Comments: 20 (9 by maintainers)

Commits related to this issue

Most upvoted comments

I’m going to move this to the MSBuild repo. I don’t know offhand why we’d start going down this long-existant codepath now.