Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support VBCSCompiler being compiled with --self-contained (or equivalent) #41650

Merged
Merged
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
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