Skip to content

Roslynator CLI not working on container image of sdk 10.0 #1716

@gbschenkel

Description

@gbschenkel

I am trying to run the roslynator.dotnet.cli inside the mcr.microsoft.com/dotnet/sdk:10.0 I got this issue:

root@0c1dd6bd404b:/observability# dotnet tool run roslynator analyze --severity-level info --output roslynator-report.xml --output-format xml
Loading solution '/observability/observability.slnx'...
System.AggregateException: One or more errors occurred. (The project file could not be loaded. System.MissingFieldException: Field not found: 'Microsoft.Build.Shared.MSBuildConstants.InvalidPathChars'.
   at Microsoft.Build.Construction.SolutionFile.ValidateProjectRelativePath(ProjectInSolution proj)
   at Microsoft.Build.Construction.SolutionFile.ReadProjects(SolutionModel solutionModel)
   at Microsoft.Build.Construction.SolutionFile.ReadSolutionModel(SolutionModel solutionModel)
   at Microsoft.Build.Construction.SolutionFile.ParseUsingNewParser()  /observability/observability.slnx)
 ---> Microsoft.Build.Exceptions.InvalidProjectFileException: The project file could not be loaded. System.MissingFieldException: Field not found: 'Microsoft.Build.Shared.MSBuildConstants.InvalidPathChars'.
   at Microsoft.Build.Construction.SolutionFile.ValidateProjectRelativePath(ProjectInSolution proj)
   at Microsoft.Build.Construction.SolutionFile.ReadProjects(SolutionModel solutionModel)
   at Microsoft.Build.Construction.SolutionFile.ReadSolutionModel(SolutionModel solutionModel)
   at Microsoft.Build.Construction.SolutionFile.ParseUsingNewParser()  /observability/observability.slnx
   at Microsoft.Build.Shared.ProjectFileErrorUtilities.VerifyThrowInvalidProjectFile(Boolean condition, String errorSubCategoryResourceName, BuildEventFileInfo projectFile, Exception innerException, String resourceName, Object[] args)
   at Microsoft.Build.Construction.SolutionFile.ParseUsingNewParser()
   at Microsoft.Build.Construction.SolutionFile.Parse(String solutionFile)
   at Microsoft.CodeAnalysis.MSBuild.MSBuildProjectLoader.LoadSolutionInfoAsync(String solutionFilePath, IProgress`1 progress, ILogger msbuildLogger, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.MSBuild.MSBuildWorkspace.OpenSolutionAsync(String solutionFilePath, ILogger msbuildLogger, IProgress`1 progress, CancellationToken cancellationToken)
   at Roslynator.CommandLine.MSBuildWorkspaceCommand`1.OpenProjectOrSolutionAsync(String path, MSBuildWorkspace workspace, IProgress`1 progress, CancellationToken cancellationToken) in /_/src/CommandLine/Commands/MSBuildWorkspaceCommand.cs:line 242
   at Roslynator.CommandLine.MSBuildWorkspaceCommand`1.ExecuteAsync(String path, MSBuildWorkspace workspace, CancellationToken cancellationToken) in /_/src/CommandLine/Commands/MSBuildWorkspaceCommand.cs:line 151
   at Roslynator.CommandLine.MSBuildWorkspaceCommand`1.ExecuteAsync(IEnumerable`1 paths, String msbuildPath, IEnumerable`1 properties) in /_/src/CommandLine/Commands/MSBuildWorkspaceCommand.cs:line 89
   at Roslynator.CommandLine.Program.AnalyzeAsync(AnalyzeCommandLineOptions options) in /_/src/CommandLine/Program.cs:line 346
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
   at Roslynator.CommandLine.Program.<>c.<Main>b__0_3(MSBuildCommandLineOptions options) in /_/src/CommandLine/Program.cs:line 175
   at CommandLine.ParserResultExtensions.MapResult[T1,T2,TResult](ParserResult`1 result, Func`2 parsedFunc1, Func`2 parsedFunc2, Func`2 notParsedFunc)
   at Roslynator.CommandLine.Program.Main(String[] args) in /_/src/CommandLine/Program.cs:line 169

Now if I use the mcr.microsoft.com/dotnet/sdk:9.0 image I got a lot of errors on my code already complaint with C# 14.0.

For now the only solution is use mcr.microsoft.com/dotnet/sdk:10.0 and download the sdk9.0 inside it.
I am using this command:
curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --channel 9.0 --install-dir /usr/share/dotnet

Appears the the roslynator.dotnet.cli is using some dependency which got refactored in sdk 10.0. Maybe a simple rebuild with sdk10.0 would resolve it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions