Skip to content

Commit

Permalink
Remove IO.Redist from GetPathToBuildToolsFile (#11270)
Browse files Browse the repository at this point in the history
Avoids microsoft/azure-pipelines-tasks#20734 by directly using `File.Exists` in codepaths that didn't use `Microsoft.IO.Redist` until 642eed5 and turn out to be critical to the current implementation of AzDO MSBuild-using tasks.

Backport of bfa266d.
  • Loading branch information
SimaTian authored Jan 14, 2025
1 parent 524caa3 commit bfea91c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the MIT license. See License.txt in the project root for full license information. -->
<Project>
<PropertyGroup>
<VersionPrefix>17.13.5</VersionPrefix>
<VersionPrefix>17.13.6</VersionPrefix>
<DotNetFinalVersionKind>release</DotNetFinalVersionKind>
<PackageValidationBaselineVersion>17.12.6</PackageValidationBaselineVersion>
<AssemblyVersion>15.1.0.0</AssemblyVersion>
Expand Down
7 changes: 4 additions & 3 deletions src/Shared/FrameworkLocationHelper.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Licensed to the .NET Foundation under one or more agreements.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
Expand Down Expand Up @@ -1390,10 +1390,11 @@ public virtual string GetPathToDotNetFramework(DotNetFrameworkArchitecture archi
// Assume if either MSBuild.exe or Microsoft.Build.dll are shipped, there is a valid install.
// Note: net481 did not ship an ARM64 MSBuild.exe, so checking its dll's is the fallback for a valid install.
// Context: https://github.com/dotnet/msbuild/pull/7689
// Rollback see https://developercommunity.visualstudio.com/t/Unable-to-locate-MSBuild-path-with-Lates/10824132
if (this._hasMsBuild &&
generatedPathToDotNetFramework != null &&
(!FileSystems.Default.FileExists(Path.Combine(generatedPathToDotNetFramework, NativeMethodsShared.IsWindows ? "MSBuild.exe" : "mcs.exe")) &&
!FileSystems.Default.FileExists(Path.Combine(generatedPathToDotNetFramework, "Microsoft.Build.dll"))))
(!File.Exists(Path.Combine(generatedPathToDotNetFramework, NativeMethodsShared.IsWindows ? "MSBuild.exe" : "mcs.exe")) &&
!File.Exists(Path.Combine(generatedPathToDotNetFramework, "Microsoft.Build.dll"))))
{
return null;
}
Expand Down
3 changes: 2 additions & 1 deletion src/Utilities/ToolLocationHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3584,7 +3584,8 @@ public static string GetPathToBuildToolsFile(string fileName, string toolsVersio
{
toolPath = Path.Combine(toolPath, fileName);

if (!FileSystems.Default.FileExists(toolPath))
// Rollback see https://developercommunity.visualstudio.com/t/Unable-to-locate-MSBuild-path-with-Lates/10824132
if (!File.Exists(toolPath))
{
toolPath = null;
}
Expand Down

0 comments on commit bfea91c

Please sign in to comment.