You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The source built SDK for .NET 10 currently doesn't have a functional dotnet-format tool. Attempting to run it on a project results in the following error:
Unhandled exception: Microsoft.CodeAnalysis.MSBuild.RemoteInvocationException: An exception of type System.IO.FileNotFoundException was thrown: Could not load file or assembly 'Microsoft.Build.Locator, Version=1.6.10.0, Culture=neutral, PublicKeyToken=9dff12846e04bfbd'. The system cannot find the file specified.
at Microsoft.CodeAnalysis.MSBuild.RpcClient.InvokeCoreAsync(Int32 targetObject, String methodName, List1 parameters, Type expectedReturnType, CancellationToken cancellationToken) at Microsoft.CodeAnalysis.MSBuild.RpcClient.InvokeAsync[T](Int32 targetObject, String methodName, List1 parameters, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.MSBuild.RemoteBuildHost.LoadProjectFileAsync(String projectFilePath, String languageName, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.MSBuild.MSBuildProjectLoader.Worker.DoOperationAndReportProgressAsync[TResult](ProjectLoadOperation operation, String projectPath, String targetFramework, Func1 doFunc) at Microsoft.CodeAnalysis.MSBuild.MSBuildProjectLoader.Worker.LoadProjectFileInfosAsync(String projectPath, DiagnosticReportingOptions reportingOptions, CancellationToken cancellationToken) at Microsoft.CodeAnalysis.MSBuild.MSBuildProjectLoader.Worker.LoadProjectInfosFromPathAsync(String projectPath, DiagnosticReportingOptions reportingOptions, CancellationToken cancellationToken) at Microsoft.CodeAnalysis.MSBuild.MSBuildProjectLoader.Worker.LoadAsync(CancellationToken cancellationToken) at Microsoft.CodeAnalysis.MSBuild.MSBuildProjectLoader.LoadProjectInfoAsync(String projectFilePath, ProjectMap projectMap, IProgress1 progress, ILogger msbuildLogger, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.MSBuild.MSBuildProjectLoader.LoadProjectInfoAsync(String projectFilePath, ProjectMap projectMap, IProgress1 progress, ILogger msbuildLogger, CancellationToken cancellationToken) at Microsoft.CodeAnalysis.MSBuild.MSBuildWorkspace.OpenProjectAsync(String projectFilePath, ILogger msbuildLogger, IProgress1 progress, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.Tools.Workspaces.MSBuildWorkspaceLoader.LoadAsync(String solutionOrProjectPath, WorkspaceType workspaceType, String binaryLogPath, Boolean logWorkspaceWarnings, ILogger logger, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.Tools.CodeFormatter.OpenMSBuildWorkspaceAsync(String solutionOrProjectPath, WorkspaceType workspaceType, Boolean noRestore, Boolean requiresSemantics, String binaryLogPath, Boolean logWorkspaceWarnings, ILogger logger, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.Tools.CodeFormatter.FormatWorkspaceAsync(FormatOptions formatOptions, ILogger logger, CancellationToken cancellationToken, String binaryLogPath)
at Microsoft.CodeAnalysis.Tools.FormatCommandCommon.FormatAsync(FormatOptions formatOptions, ILogger`1 logger, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.Tools.Commands.RootFormatCommand.FormatCommandDefaultHandler.InvokeAsync(ParseResult parseResult, CancellationToken cancellationToken)
at System.CommandLine.Invocation.InvocationPipeline.InvokeAsync(ParseResult parseResult, CancellationToken cancellationToken)
This occurs because Microsoft.Build.Locator is not referenced by the sdk/<version>/DotnetTools/dotnet-format/BuildHost-netcore/Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost.deps.json file. If you manually update the file to reference Microsoft.Build.Locator, dotnet-format will run successfully.
The reason Microsoft.Build.Locator is not in the deps.json file is because a recent SDK change (dotnet/sdk#45259) combined with the Microsoft.Build.Locator package reference being defined with PrivateAssets="All":
This doesn't currently affect the Microsoft-built SDK because that is using assets produced by Roslyn's build which is currently using the .NET 9 SDK. So it will eventually be an issue for the Microsoft-built SDK whenever roslyn updates its global.json to use a .NET 10 SDK. However, this needs to be addressed now because source build builds all repos with the .NET 10 SDK and we want to have a usable dotnet-format tool for the source built SDK in .NET 10 Preview 1.
The text was updated successfully, but these errors were encountered:
The source built SDK for .NET 10 currently doesn't have a functional dotnet-format tool. Attempting to run it on a project results in the following error:
This was identified in dotnet/sdk#46055 (comment).
This occurs because Microsoft.Build.Locator is not referenced by the
sdk/<version>/DotnetTools/dotnet-format/BuildHost-netcore/Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost.deps.json
file. If you manually update the file to reference Microsoft.Build.Locator, dotnet-format will run successfully.The reason Microsoft.Build.Locator is not in the deps.json file is because a recent SDK change (dotnet/sdk#45259) combined with the Microsoft.Build.Locator package reference being defined with
PrivateAssets="All"
:roslyn/src/Workspaces/Core/MSBuild.BuildHost/Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost.csproj
Line 45 in c2b719c
This doesn't currently affect the Microsoft-built SDK because that is using assets produced by Roslyn's build which is currently using the .NET 9 SDK. So it will eventually be an issue for the Microsoft-built SDK whenever roslyn updates its global.json to use a .NET 10 SDK. However, this needs to be addressed now because source build builds all repos with the .NET 10 SDK and we want to have a usable dotnet-format tool for the source built SDK in .NET 10 Preview 1.
The text was updated successfully, but these errors were encountered: