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
- Disable MotW check on core in GenerateResource (#8234) Fixes #7946 Context The GenerateResource task previously would deserialize and reserialize resource files. It used BinaryFormatter, which is... — committed to dotnet/msbuild by Forgind a year ago
- An attempt to fix MSB4018: System.Runtime.InteropServices.COMException (0x80040154): Retrieving the COM class factory for component with CLSID {7B8A2D94-0AC9-11D1-896C-00C04FB6BFC4} failed due to the ... — committed to anton-vetrov/Covid by anton-vetrov a year ago
- Azure pipelines test (#1) * Running unit tests * Building feature branches * Migrated to .NET 5 * Fixed flaky unit test * An appropriate way to throw GithubException * Migrated docker to 5.0 * ... — committed to anton-vetrov/Covid by anton-vetrov a year ago
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.