diff --git a/Directory.Packages.props b/Directory.Packages.props index 7ffe4dc800..72c148580a 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -12,7 +12,6 @@ - @@ -30,6 +29,10 @@ + diff --git a/NuGet.config b/NuGet.config index d6f6d374aa..3b8c810510 100644 --- a/NuGet.config +++ b/NuGet.config @@ -10,4 +10,5 @@ + diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index b3c0885e60..242dfd109e 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -5,9 +5,9 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime 5535e31a712343a63f5d7d796cd874e563e5ac14 - + https://github.com/dotnet/roslyn - 263571123fc3dc4a638e071234ac9fbf91913962 + 9934fb9e3527e1c0c51314e57d4aab30f97e8f9e diff --git a/eng/Versions.props b/eng/Versions.props index 5cd5748fe9..7fbcf57d1e 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -1,7 +1,7 @@ 8 - 0 + 2 6.8.0-rc.122 - 4.8.0-7.24067.24 + 4.9.2-3.24129.6 1.1.2-beta1.22216.1 diff --git a/global.json b/global.json index f8014fc3fd..9b99c16b65 100644 --- a/global.json +++ b/global.json @@ -1,11 +1,11 @@ { "sdk": { - "version": "8.0.100-rtm.23506.1", + "version": "8.0.101", "allowPrerelease": true, "rollForward": "major" }, "tools": { - "dotnet": "8.0.100-rtm.23506.1" + "dotnet": "8.0.101" }, "msbuild-sdks": { "Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.23525.4" diff --git a/perf/FormattedFiles.cs b/perf/FormattedFiles.cs index 3631d4953f..37d86520f5 100644 --- a/perf/FormattedFiles.cs +++ b/perf/FormattedFiles.cs @@ -23,7 +23,6 @@ public class FormattedFiles public void NoFilesFormattedSetup() { SolutionPathSetter.SetCurrentDirectory(); - MSBuildRegister.RegisterInstance(Environment.CurrentDirectory); } [Benchmark(Description = "Whitespace Formatting (folder)")] diff --git a/perf/NoFilesFormatted.cs b/perf/NoFilesFormatted.cs index 120b9b4fbf..5804c69d30 100644 --- a/perf/NoFilesFormatted.cs +++ b/perf/NoFilesFormatted.cs @@ -23,7 +23,6 @@ public class NoFilesFormatted public void NoFilesFormattedSetup() { SolutionPathSetter.SetCurrentDirectory(); - MSBuildRegister.RegisterInstance(Environment.CurrentDirectory); } [Benchmark(Description = "No Files are Formatted (folder)")] diff --git a/perf/RealWorldSolution.cs b/perf/RealWorldSolution.cs index 4702fb1e18..eef9b7481f 100644 --- a/perf/RealWorldSolution.cs +++ b/perf/RealWorldSolution.cs @@ -24,7 +24,6 @@ public class RealWorldSolution public void RealWorldSolutionIterationSetup() { SolutionPathSetter.SetCurrentDirectory(); - MSBuildRegister.RegisterInstance(Environment.CurrentDirectory); } [Benchmark(Description = "Formatting Solution")] diff --git a/perf/Utilities/MSBuildRegister.cs b/perf/Utilities/MSBuildRegister.cs deleted file mode 100644 index be0a79ae53..0000000000 --- a/perf/Utilities/MSBuildRegister.cs +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Threading; - -namespace Microsoft.CodeAnalysis.Tools.Perf -{ - public static class MSBuildRegister - { - private static int s_registered; - - public static void RegisterInstance(string solutionDir) - { - if (Interlocked.Exchange(ref s_registered, 1) == 0) - { - var pathsToSearch = new List(); - var sdkDirectory = new DirectoryInfo(Path.Combine(solutionDir, @".dotnet\sdk")); - pathsToSearch.AddRange(sdkDirectory.EnumerateDirectories().Select(x => x.FullName)); - - var programFiles = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles); - if (programFiles is not null) - { - var sdkPath = Path.Combine(programFiles, "dotnet", "sdk"); - if (Directory.Exists(sdkPath)) - { - sdkDirectory = new DirectoryInfo(Path.Combine(programFiles, @"dotnet\sdk")); - pathsToSearch.AddRange(sdkDirectory.EnumerateDirectories().Select(x => x.FullName)); - } - } - - var programFilesX86 = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86); - if (programFilesX86 is not null) - { - var installs = Path.Combine(programFiles, "Microsoft Visual Studio", "2019"); - if (Directory.Exists(installs)) - { - pathsToSearch.AddRange(new DirectoryInfo(installs).EnumerateDirectories() - .Select(install => Path.Combine(install.FullName, "MSBuild", "Current", "Bin"))); - } - } - - Build.Locator.MSBuildLocator.RegisterMSBuildPath(pathsToSearch.ToArray()); - } - } - } -} diff --git a/src/Commands/FormatCommandCommon.cs b/src/Commands/FormatCommandCommon.cs index d2ed8fad0c..0e2bdf052f 100644 --- a/src/Commands/FormatCommandCommon.cs +++ b/src/Commands/FormatCommandCommon.cs @@ -115,14 +115,6 @@ internal static async Task FormatAsync(FormatOptions formatOptions, ILogger } logger.LogTrace(Resources.The_dotnet_CLI_version_is_0, dotnetVersion); - - if (!TryLoadMSBuild(out var msBuildPath)) - { - logger.LogError(Resources.Unable_to_locate_MSBuild_Ensure_the_NET_SDK_was_installed_with_the_official_installer); - return UnableToLocateMSBuildExitCode; - } - - logger.LogTrace(Resources.Using_msbuildexe_located_in_0, msBuildPath); } var formatResult = await CodeFormatter.FormatWorkspaceAsync( @@ -377,34 +369,6 @@ internal static bool TryGetDotNetCliVersion([NotNullWhen(returnValue: true)] out } } - internal static bool TryLoadMSBuild([NotNullWhen(returnValue: true)] out string? msBuildPath) - { - try - { - // Get the global.json pinned SDK or latest instance. - var msBuildInstance = Build.Locator.MSBuildLocator.QueryVisualStudioInstances() - .Where(instance => instance.Version.Major >= 6) - .FirstOrDefault(); - if (msBuildInstance is null) - { - msBuildPath = null; - return false; - } - - msBuildPath = Path.EndsInDirectorySeparator(msBuildInstance.MSBuildPath) - ? msBuildInstance.MSBuildPath - : msBuildInstance.MSBuildPath + Path.DirectorySeparatorChar; - - Build.Locator.MSBuildLocator.RegisterMSBuildPath(msBuildPath); - return true; - } - catch - { - msBuildPath = null; - return false; - } - } - internal static string GetRuntimeVersion() { var pathParts = typeof(string).Assembly.Location.Split('\\', '/'); diff --git a/src/Resources.resx b/src/Resources.resx index 999aa66a5a..9fa477a1ea 100644 --- a/src/Resources.resx +++ b/src/Resources.resx @@ -216,9 +216,6 @@ Using MSBuild.exe located in '{0}'. - - Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. - Include generated code files in formatting operations. diff --git a/src/dotnet-format.csproj b/src/dotnet-format.csproj index 32425756de..3bab150c53 100644 --- a/src/dotnet-format.csproj +++ b/src/dotnet-format.csproj @@ -28,7 +28,6 @@ - diff --git a/src/xlf/Resources.cs.xlf b/src/xlf/Resources.cs.xlf index 1423925215..c83e882488 100644 --- a/src/xlf/Resources.cs.xlf +++ b/src/xlf/Resources.cs.xlf @@ -372,11 +372,6 @@ Unable to fix {0}. No associated code fix found. - - Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. - Nepovedlo se najít MSBuild. Ujistěte se, že se sada .NET SDK nainstalovala pomocí oficiálního instalačního programu. - - Unable to locate dotnet CLI. Ensure that it is on the PATH. Nepovedlo se najít .NET CLI. Ujistěte se, že se nachází v proměnné PATH. diff --git a/src/xlf/Resources.de.xlf b/src/xlf/Resources.de.xlf index 7c7bc4bb62..2eff686dd2 100644 --- a/src/xlf/Resources.de.xlf +++ b/src/xlf/Resources.de.xlf @@ -372,11 +372,6 @@ Unable to fix {0}. No associated code fix found. - - Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. - MSBuild wurde nicht gefunden. Stellen Sie sicher, dass das .NET SDK mit dem offiziellen Installationsprogramm installiert wurde. - - Unable to locate dotnet CLI. Ensure that it is on the PATH. Die dotnet-CLI wurde nicht gefunden. Stellen Sie sicher, dass sie sich im Pfad befindet. diff --git a/src/xlf/Resources.es.xlf b/src/xlf/Resources.es.xlf index 098f102e48..bbaa6e2e2f 100644 --- a/src/xlf/Resources.es.xlf +++ b/src/xlf/Resources.es.xlf @@ -372,11 +372,6 @@ Unable to fix {0}. No associated code fix found. - - Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. - No se encuentra MSBuild. Asegúrese de que el SDK de .NET se haya instalado con el instalador oficial. - - Unable to locate dotnet CLI. Ensure that it is on the PATH. No se encuentra la CLI de dotnet. Asegúrese de que esté en la ruta de acceso (PATH). diff --git a/src/xlf/Resources.fr.xlf b/src/xlf/Resources.fr.xlf index e978b44516..596dfb22b8 100644 --- a/src/xlf/Resources.fr.xlf +++ b/src/xlf/Resources.fr.xlf @@ -372,11 +372,6 @@ Unable to fix {0}. No associated code fix found. - - Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. - Impossible de localiser MSBuild. Vérifiez que le SDK .NET a été installé avec le programme d'installation officiel. - - Unable to locate dotnet CLI. Ensure that it is on the PATH. Impossible de localiser l'interface CLI dotnet. Vérifiez qu'elle est dans le chemin. diff --git a/src/xlf/Resources.it.xlf b/src/xlf/Resources.it.xlf index 0cbcb39ae3..778ca288b4 100644 --- a/src/xlf/Resources.it.xlf +++ b/src/xlf/Resources.it.xlf @@ -372,11 +372,6 @@ Unable to fix {0}. No associated code fix found. - - Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. - Non è possibile individuare MSBuild. Assicurarsi che .NET SDK sia stato installato con il programma di installazione ufficiale. - - Unable to locate dotnet CLI. Ensure that it is on the PATH. Non è possibile individuare l'interfaccia della riga di comando di dotnet. Assicurarsi che sia indicata in PATH. diff --git a/src/xlf/Resources.ja.xlf b/src/xlf/Resources.ja.xlf index f103dba3e3..344ef6b5e6 100644 --- a/src/xlf/Resources.ja.xlf +++ b/src/xlf/Resources.ja.xlf @@ -372,11 +372,6 @@ Unable to fix {0}. No associated code fix found. - - Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. - MSBuild が見つかりません。.NET SDK が正式なインストーラーでインストールされたことを確認してください。 - - Unable to locate dotnet CLI. Ensure that it is on the PATH. dotnet CLI が見つかりません。PATH 上にあることを確認してください。 diff --git a/src/xlf/Resources.ko.xlf b/src/xlf/Resources.ko.xlf index e361702044..97283d833d 100644 --- a/src/xlf/Resources.ko.xlf +++ b/src/xlf/Resources.ko.xlf @@ -372,11 +372,6 @@ Unable to fix {0}. No associated code fix found. - - Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. - MSBuild를 찾을 수 없습니다. 공식 설치 관리자를 사용하여 .NET SDK를 설치했는지 확인하세요. - - Unable to locate dotnet CLI. Ensure that it is on the PATH. dotnet CLI를 찾을 수 없습니다. PATH에 있는지 확인하세요. diff --git a/src/xlf/Resources.pl.xlf b/src/xlf/Resources.pl.xlf index 718e6a2f9d..d1483d49d1 100644 --- a/src/xlf/Resources.pl.xlf +++ b/src/xlf/Resources.pl.xlf @@ -372,11 +372,6 @@ Unable to fix {0}. No associated code fix found. - - Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. - Nie można zlokalizować programu MSBuild. Upewnij się, że zestaw .NET SDK został zainstalowany przy użyciu oficjalnego instalatora. - - Unable to locate dotnet CLI. Ensure that it is on the PATH. Nie można zlokalizować wiersza polecenia dotnet. Upewnij się, że znajduje się on w ścieżce. diff --git a/src/xlf/Resources.pt-BR.xlf b/src/xlf/Resources.pt-BR.xlf index 9a8687ea74..f251bd1d08 100644 --- a/src/xlf/Resources.pt-BR.xlf +++ b/src/xlf/Resources.pt-BR.xlf @@ -372,11 +372,6 @@ Unable to fix {0}. No associated code fix found. - - Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. - Não é possível localizar o MSBuild. Verifique se o SDK do .NET foi instalado com o instalador oficial. - - Unable to locate dotnet CLI. Ensure that it is on the PATH. Não é possível localizar a CLI do dotnet. Verifique se está no CAMINHO. diff --git a/src/xlf/Resources.ru.xlf b/src/xlf/Resources.ru.xlf index 8898532273..273883f134 100644 --- a/src/xlf/Resources.ru.xlf +++ b/src/xlf/Resources.ru.xlf @@ -372,11 +372,6 @@ Unable to fix {0}. No associated code fix found. - - Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. - Не удается найти MSBuild. Убедитесь, что пакет SDK для .NET был установлен с официальным установщиком. - - Unable to locate dotnet CLI. Ensure that it is on the PATH. Не удалось найти CLI dotnet. Убедитесь, что путь к нему добавлен в переменную среды PATH. diff --git a/src/xlf/Resources.tr.xlf b/src/xlf/Resources.tr.xlf index 8ca53319d8..aad1bb4c3c 100644 --- a/src/xlf/Resources.tr.xlf +++ b/src/xlf/Resources.tr.xlf @@ -372,11 +372,6 @@ Unable to fix {0}. No associated code fix found. - - Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. - MSBuild bulunamıyor. .NET SDK'nın resmi yükleyici kullanılarak yüklendiğinden emin olun. - - Unable to locate dotnet CLI. Ensure that it is on the PATH. dotnet CLI bulunamıyor. dotnet CLI'nin PATH üzerinde olduğundan emin olun. diff --git a/src/xlf/Resources.zh-Hans.xlf b/src/xlf/Resources.zh-Hans.xlf index 28792812f6..b356bc647a 100644 --- a/src/xlf/Resources.zh-Hans.xlf +++ b/src/xlf/Resources.zh-Hans.xlf @@ -372,11 +372,6 @@ Unable to fix {0}. No associated code fix found. - - Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. - 无法找到 MSBuild。请确保 .NET SDK 是与官方安装程序一起安装的。 - - Unable to locate dotnet CLI. Ensure that it is on the PATH. 找不到 dotnet CLI。请确保它在路径上。 diff --git a/src/xlf/Resources.zh-Hant.xlf b/src/xlf/Resources.zh-Hant.xlf index 78caaaf3b6..a5a1a5c6a6 100644 --- a/src/xlf/Resources.zh-Hant.xlf +++ b/src/xlf/Resources.zh-Hant.xlf @@ -372,11 +372,6 @@ Unable to fix {0}. No associated code fix found. - - Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. - 找不到 MSBuild。請確認已使用正式安裝程式安裝了 .NET SDK。 - - Unable to locate dotnet CLI. Ensure that it is on the PATH. 找不到 dotnet CLI。請確認其位於 PATH 上。 diff --git a/tests/Analyzers/ThirdPartyAnalyzerFormatterTests.cs b/tests/Analyzers/ThirdPartyAnalyzerFormatterTests.cs index 9cea8fe247..00f5da6190 100644 --- a/tests/Analyzers/ThirdPartyAnalyzerFormatterTests.cs +++ b/tests/Analyzers/ThirdPartyAnalyzerFormatterTests.cs @@ -43,7 +43,6 @@ public async Task InitializeAsync() // Load the analyzer_project into a MSBuildWorkspace. var workspacePath = Path.Combine(TestProjectsPathHelper.GetProjectsDirectory(), s_analyzerProjectFilePath); - MSBuildRegistrar.RegisterInstance(); var analyzerWorkspace = await MSBuildWorkspaceLoader.LoadAsync(workspacePath, WorkspaceType.Project, binaryLogPath: null, logWorkspaceWarnings: true, logger, CancellationToken.None); TestOutputHelper.WriteLine(logger.GetLog()); diff --git a/tests/CodeFormatterTests.cs b/tests/CodeFormatterTests.cs index d179e921f2..084e5c772a 100644 --- a/tests/CodeFormatterTests.cs +++ b/tests/CodeFormatterTests.cs @@ -665,9 +665,6 @@ internal async Task TestFormatWorkspaceAsync( } var logger = new TestLogger(); - var msBuildPath = MSBuildRegistrar.RegisterInstance(); - - logger.LogTrace(Resources.Using_msbuildexe_located_in_0, msBuildPath); var fileMatcher = SourceFileMatcher.CreateMatcher(include, exclude); var formatOptions = new FormatOptions( diff --git a/tests/MSBuild/MSBuildWorkspaceLoaderTests.cs b/tests/MSBuild/MSBuildWorkspaceLoaderTests.cs index 0a05700d99..19419ba4d7 100644 --- a/tests/MSBuild/MSBuildWorkspaceLoaderTests.cs +++ b/tests/MSBuild/MSBuildWorkspaceLoaderTests.cs @@ -138,7 +138,6 @@ private static async Task AssertProjectLoadsCleanlyAsync(string projectFilePath, { var binaryLogPath = Path.ChangeExtension(projectFilePath, ".binlog"); - MSBuildRegistrar.RegisterInstance(); using var workspace = (MSBuildWorkspace)await MSBuildWorkspaceLoader.LoadAsync(projectFilePath, WorkspaceType.Project, binaryLogPath, logWorkspaceWarnings: true, logger, CancellationToken.None); Assert.Empty(workspace.Diagnostics); diff --git a/tests/Utilities/MSBuildRegistrar.cs b/tests/Utilities/MSBuildRegistrar.cs deleted file mode 100644 index db71158834..0000000000 --- a/tests/Utilities/MSBuildRegistrar.cs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. - -using System.IO; -using System.Linq; -using System.Threading; - -#nullable enable - -namespace Microsoft.CodeAnalysis.Tools.Tests.Utilities -{ - /// - /// Loads MSBuild assemblies. - /// - public sealed class MSBuildRegistrar - { - private static int s_registered; - - private static string? s_msBuildPath; - - public static string RegisterInstance() - { - if (Interlocked.Exchange(ref s_registered, 1) == 0) - { - var msBuildInstance = Build.Locator.MSBuildLocator.QueryVisualStudioInstances().First(); - s_msBuildPath = Path.EndsInDirectorySeparator(msBuildInstance.MSBuildPath) - ? msBuildInstance.MSBuildPath - : msBuildInstance.MSBuildPath + Path.DirectorySeparatorChar; - Build.Locator.MSBuildLocator.RegisterMSBuildPath(s_msBuildPath); - } - - return s_msBuildPath!; - } - } -} diff --git a/tests/dotnet-format.UnitTests.csproj b/tests/dotnet-format.UnitTests.csproj index 5f40b8dae9..b46c67f339 100644 --- a/tests/dotnet-format.UnitTests.csproj +++ b/tests/dotnet-format.UnitTests.csproj @@ -14,15 +14,6 @@ - - - - - - - -