Skip to content

Commit bfea91c

Browse files
authored
Remove IO.Redist from GetPathToBuildToolsFile (#11270)
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.
1 parent 524caa3 commit bfea91c

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

eng/Versions.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<!-- 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. -->
33
<Project>
44
<PropertyGroup>
5-
<VersionPrefix>17.13.5</VersionPrefix>
5+
<VersionPrefix>17.13.6</VersionPrefix>
66
<DotNetFinalVersionKind>release</DotNetFinalVersionKind>
77
<PackageValidationBaselineVersion>17.12.6</PackageValidationBaselineVersion>
88
<AssemblyVersion>15.1.0.0</AssemblyVersion>

src/Shared/FrameworkLocationHelper.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Licensed to the .NET Foundation under one or more agreements.
1+
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

44
using System;
@@ -1390,10 +1390,11 @@ public virtual string GetPathToDotNetFramework(DotNetFrameworkArchitecture archi
13901390
// Assume if either MSBuild.exe or Microsoft.Build.dll are shipped, there is a valid install.
13911391
// Note: net481 did not ship an ARM64 MSBuild.exe, so checking its dll's is the fallback for a valid install.
13921392
// Context: https://github.com/dotnet/msbuild/pull/7689
1393+
// Rollback see https://developercommunity.visualstudio.com/t/Unable-to-locate-MSBuild-path-with-Lates/10824132
13931394
if (this._hasMsBuild &&
13941395
generatedPathToDotNetFramework != null &&
1395-
(!FileSystems.Default.FileExists(Path.Combine(generatedPathToDotNetFramework, NativeMethodsShared.IsWindows ? "MSBuild.exe" : "mcs.exe")) &&
1396-
!FileSystems.Default.FileExists(Path.Combine(generatedPathToDotNetFramework, "Microsoft.Build.dll"))))
1396+
(!File.Exists(Path.Combine(generatedPathToDotNetFramework, NativeMethodsShared.IsWindows ? "MSBuild.exe" : "mcs.exe")) &&
1397+
!File.Exists(Path.Combine(generatedPathToDotNetFramework, "Microsoft.Build.dll"))))
13971398
{
13981399
return null;
13991400
}

src/Utilities/ToolLocationHelper.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3584,7 +3584,8 @@ public static string GetPathToBuildToolsFile(string fileName, string toolsVersio
35843584
{
35853585
toolPath = Path.Combine(toolPath, fileName);
35863586

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

0 commit comments

Comments
 (0)