msbuild: InvalidOperationException from TaskLoggingHelper.FormatResourceString(): The "Csc" task has not registered its resources.
Building using bootstrap MSBuild from 80b7f2dcb has resulted in a Csc failure:
Csc
Assembly = C:\msbuild\artifacts\bin\bootstrap\net472\MSBuild\Current\Bin\Roslyn\Microsoft.Build.Tasks.CodeAnalysis.dll
C:\msbuild\artifacts\bin\bootstrap\net472\MSBuild\Current\Bin\Roslyn
Microsoft (R) Visual C# Compiler version 3.9.0-2.20574.26 (e9fd4dc7)
Errors
C:\msbuild\artifacts\bin\bootstrap\net472\MSBuild\Current\Bin\Roslyn\Microsoft.CSharp.Core.targets(71,5): error MSB4018: The "Csc" task failed unexpectedly.
This is an unhandled exception from a task -- PLEASE OPEN A BUG AGAINST THE TASK OWNER.
System.InvalidOperationException: The "Csc" task has not registered its resources. In order to use the "TaskLoggingHelper.FormatResourceString()" method this task needs to register its resources either during construction, or via the "TaskResources" property.
at Microsoft.Build.Shared.ErrorUtilities.ThrowInvalidOperation(String resourceName, Object[] args) in C:\msbuild\src\Shared\ErrorUtilities.cs:line 327
at Microsoft.Build.Shared.ErrorUtilities.VerifyThrowInvalidOperation(Boolean condition, String resourceName, Object arg0) in C:\msbuild\src\Shared\ErrorUtilities.cs:line 368
at Microsoft.Build.Utilities.TaskLoggingHelper.FormatResourceString(String resourceName, Object[] args) in C:\msbuild\src\Shared\TaskLoggingHelper.cs:line 203
at Microsoft.Build.Utilities.TaskLoggingHelper.LogErrorWithCodeFromResources(String subcategoryResourceName, String file, Int32 lineNumber, Int32 columnNumber, Int32 endLineNumber, Int32 endColumnNumber, String messageResourceName, Object[] messageArgs) in C:\msbuild\src\Shared\TaskLoggingHelper.cs:line 825
at Microsoft.Build.Utilities.TaskLoggingHelper.LogErrorWithCodeFromResources(String messageResourceName, Object[] messageArgs) in C:\msbuild\src\Shared\TaskLoggingHelper.cs:line 779
at Microsoft.CodeAnalysis.BuildTasks.ManagedCompiler.ExecuteTool(String pathToTool, String responseFileCommands, String commandLineCommands)
at Microsoft.Build.Utilities.ToolTask.Execute() in C:\msbuild\src\Utilities\ToolTask.cs:line 1519
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() in C:\msbuild\src\Build\BackEnd\TaskExecutionHost\TaskExecutionHost.cs:line 578
at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() in C:\msbuild\src\Build\BackEnd\Components\RequestBuilder\TaskBuilder.cs:line 809 [C:\Ide\src\CodexShell\CodexShell.csproj]
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 29 (22 by maintainers)
This was fixed in https://github.com/dotnet/roslyn/pull/52836. Newer versions of the SDK should have the fix and give the correct stack traces.
I got the same problem. And it is very interesting that when I run Visual Studio as administrator, I was able to get build without any problem.