Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion eng/Version.Details.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Dependencies>
<Source Uri="https://github.com/dotnet/dotnet" Mapping="msbuild" Sha="e9593819ed84a62923fe87c8d0958025726934c3" BarId="305927" />
<Source Uri="https://github.com/dotnet/dotnet" Mapping="msbuild" Sha="463e0cf2f2b2fb9b136f6440341ff1e7b0a93acf" BarId="322439" />
<ProductDependencies>
<!-- Necessary for source-build. This allows the live version of the package to be used by source-build. -->
<Dependency Name="System.CodeDom" Version="10.0.3">
Expand Down
2 changes: 1 addition & 1 deletion eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Import Project="Version.Details.props" />

<PropertyGroup>
<VersionPrefix>18.6.13</VersionPrefix><DotNetFinalVersionKind>release</DotNetFinalVersionKind><!-- Keep next to VersionPrefix to create a conflict in forward-flow -->
<VersionPrefix>18.6.14</VersionPrefix><DotNetFinalVersionKind>release</DotNetFinalVersionKind><!-- Keep next to VersionPrefix to create a conflict in forward-flow -->
<PreReleaseVersionLabel>servicing</PreReleaseVersionLabel>
<PackageValidationBaselineVersion>18.5.0-preview-26126-01</PackageValidationBaselineVersion>
<AssemblyVersion>15.1.0.0</AssemblyVersion>
Expand Down
13 changes: 8 additions & 5 deletions src/Framework/NativeMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1484,15 +1484,18 @@ internal static List<KeyValuePair<int, SafeProcessHandle>> GetChildProcessIds(in
/// Internal, optimized GetCurrentDirectory implementation that simply delegates to the native method
/// </summary>
/// <returns></returns>
internal static unsafe string GetCurrentDirectory()
internal static string GetCurrentDirectory()
{
#if FEATURE_LEGACY_GETCURRENTDIRECTORY
if (IsWindows)
{
int bufferSize = GetCurrentDirectoryWin32(0, null);
char* buffer = stackalloc char[bufferSize];
int pathLength = GetCurrentDirectoryWin32(bufferSize, buffer);
return new string(buffer, startIndex: 0, length: pathLength);
unsafe
{
int bufferSize = GetCurrentDirectoryWin32(0, null);
char* buffer = stackalloc char[bufferSize];
int pathLength = GetCurrentDirectoryWin32(bufferSize, buffer);
return new string(buffer, startIndex: 0, length: pathLength);
}
}
#endif
return Directory.GetCurrentDirectory();
Expand Down
23 changes: 21 additions & 2 deletions src/MSBuild.Bootstrap.Utils/Tasks/InstallDotNetCoreTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,32 @@ private ScriptExecutionSettings SetupScriptsExecutionSettings()
{
string scriptExtension = IsWindows ? "ps1" : "sh";
string scriptPath = Path.Combine(DotNetInstallScriptRootPath, $"{ScriptName}.{scriptExtension}");
// On Windows the native command-line parser treats a backslash before the closing quote as
// escaping it (e.g. "C:\dir\" becomes C:\dir"), so trim a trailing separator before quoting.
string installDir = TrimTrailingDirectorySeparators(InstallDir);
string scriptArgs = IsWindows
? $"-NoProfile -ExecutionPolicy Bypass -File {scriptPath} -Version {Version} -InstallDir {InstallDir}"
: $"{scriptPath} --version {Version} --install-dir {InstallDir}";
? $"-NoProfile -ExecutionPolicy Bypass -File \"{scriptPath}\" -Version {Version} -InstallDir \"{installDir}\""
: $"\"{scriptPath}\" --version {Version} --install-dir \"{installDir}\"";

return new ScriptExecutionSettings($"{ScriptName}.{scriptExtension}", scriptPath, scriptArgs);
}

/// <summary>
/// Trims trailing directory separators while preserving a path root (e.g. "C:\").
/// </summary>
private static string TrimTrailingDirectorySeparators(string path)
{
string root = Path.GetPathRoot(path) ?? string.Empty;
while (path.Length > root.Length &&
(path[path.Length - 1] == Path.DirectorySeparatorChar ||
path[path.Length - 1] == Path.AltDirectorySeparatorChar))
{
path = path.Substring(0, path.Length - 1);
}

return path;
}

/// <summary>
/// A private struct to hold settings for script execution.
/// </summary>
Expand Down