【发布时间】:2022-08-18 18:28:58
【问题描述】:
我觉得最新版本的有些东西坏了mcr.microsoft.com/dotnet/sdk:6.0因为这只是几周前的工作,但我想我会在这里发帖,看看是否有人遇到过类似的问题,以及是否有修复/解决方法。
尝试构建时,抛出以下错误
Step 9/18 : RUN dotnet publish \"Test.Service.csproj\" -c Release -o /app/publish
---> Running in f763996ec9e3
MSBuild version 17.3.0+92e077650 for .NET
Determining projects to restore...
Restored C:\\src\\Test.Service\\Test.Service.csproj (in 15.18 sec).
Restored C:\\src\\Test.Core\\Test.Core.csproj (in 15.18 sec).
Restored C:\\src\\Test.DataLayer\\Test.DataLayer.csproj (in 1.74 sec).
C:\\Program Files\\dotnet\\sdk\\6.0.400\\Microsoft.Common.CurrentVersion.targets(3262,5): error MSB4018: The \"GenerateResource\" task failed unexpectedly. [C:\\src\\Test.DataLayer\\Test.DataLayer.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\\Test.DataLayer\\Test.DataLayer.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\\Test.DataLayer\\Test.DataLayer.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\\Test.DataLayer\\Test.DataLayer.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\\Test.DataLayer\\Test.DataLayer.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\\Test.DataLayer\\Test.DataLayer.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\\Test.DataLayer\\Test.DataLayer.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\\Test.DataLayer\\Test.DataLayer.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\\Test.DataLayer\\Test.DataLayer.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\\Test.DataLayer\\Test.DataLayer.csproj]
The command \'cmd /S /C dotnet publish \"Test.Service.csproj\" -c Release -o /app/publish\' returned a non-zero code: 1
这是 Docker 文件:
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY [\"NuGet.Config\", \"NuGet.Config\"]
COPY [\"Test.Service/Test.Service.csproj\", \"Test.Service/\"]
COPY [\"Test.DataLayer/Test.DataLayer.csproj\", \"Test.DataLayer/\"]
COPY . .
WORKDIR \"/src/Test.Service\"
FROM build AS publish
RUN dotnet publish \"Test.Service.csproj\" -c Release -o /app/publish
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS final
WORKDIR /app
EXPOSE 80
COPY --from=publish /app/publish .
ENTRYPOINT [\"dotnet\", \"Test.Service.dll\"]
使用时的建筑工程ubuntu-最新的代理,但我无法使用windows-最新.我也试过windows-2019有同样的问题。