Skip to content

Commit

Permalink
Support VBCSCompiler being compiled with --self-contained (or equival…
Browse files Browse the repository at this point in the history
…ent) (#41650)
  • Loading branch information
khyperia authored Feb 17, 2020
1 parent 134b217 commit 7b6c485
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Compilers/Shared/RuntimeHostInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
using System;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.IO.Pipes;
using Roslyn.Utilities;

namespace Microsoft.CodeAnalysis
{
Expand All @@ -20,6 +22,7 @@ internal static class RuntimeHostInfo
internal static bool IsCoreClrRuntime => !IsDesktopRuntime;

internal static string ToolExtension => IsCoreClrRuntime ? "dll" : "exe";
private static string NativeToolSuffix => PlatformInformation.IsWindows ? ".exe" : "";

/// <summary>
/// This gets information about invoking a tool on the current runtime. This will attempt to
Expand All @@ -29,6 +32,11 @@ internal static (string processFilePath, string commandLineArguments, string too
{
Debug.Assert(!toolFilePathWithoutExtension.EndsWith(".dll") && !toolFilePathWithoutExtension.EndsWith(".exe"));

var nativeToolFilePath = $"{toolFilePathWithoutExtension}{NativeToolSuffix}";
if (IsCoreClrRuntime && File.Exists(nativeToolFilePath))
{
return (nativeToolFilePath, commandLineArguments, nativeToolFilePath);
}
var toolFilePath = $"{toolFilePathWithoutExtension}.{ToolExtension}";
if (IsDotNetHost(out string? pathToDotNet))
{
Expand Down

0 comments on commit 7b6c485

Please sign in to comment.