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
18 changes: 13 additions & 5 deletions src/Workspaces/Core/MSBuild/MSBuild/BuildHostProcessManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -177,12 +177,14 @@ private ProcessStartInfo CreateDotNetCoreBuildHostStartInfo()
internal static string GetNetCoreBuildHostPath()
{
// The .NET Core build host is deployed as a content folder next to the application into the BuildHost-netcore path
return Path.Combine(Path.GetDirectoryName(typeof(BuildHostProcessManager).Assembly.Location)!, "BuildHost-netcore", "Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost.dll");
var buildHostPath = Path.Combine(Path.GetDirectoryName(typeof(BuildHostProcessManager).Assembly.Location)!, "BuildHost-netcore", "Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost.dll");
AssertBuildHostExists(buildHostPath);
return buildHostPath;
}

private ProcessStartInfo CreateDotNetFrameworkBuildHostStartInfo()
{
var netFrameworkBuildHost = GetPathToDotNetFrameworkBuildHost();
var netFrameworkBuildHost = GetDotNetFrameworkBuildHostPath();
var processStartInfo = new ProcessStartInfo()
{
FileName = netFrameworkBuildHost,
Expand All @@ -200,21 +202,27 @@ private ProcessStartInfo CreateMonoBuildHostStartInfo()
FileName = "mono"
};

AddArgument(processStartInfo, GetPathToDotNetFrameworkBuildHost());
AddArgument(processStartInfo, GetDotNetFrameworkBuildHostPath());

AppendBuildHostCommandLineArgumentsConfigureProcess(processStartInfo);

return processStartInfo;
}

private static string GetPathToDotNetFrameworkBuildHost()
private static string GetDotNetFrameworkBuildHostPath()
{
// The .NET Framework build host is deployed as a content folder next to the application into the BuildHost-net472 path
var netFrameworkBuildHost = Path.Combine(Path.GetDirectoryName(typeof(BuildHostProcessManager).Assembly.Location)!, "BuildHost-net472", "Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost.exe");
Contract.ThrowIfFalse(File.Exists(netFrameworkBuildHost), $"Unable to locate the .NET Framework build host at {netFrameworkBuildHost}");
AssertBuildHostExists(netFrameworkBuildHost);
return netFrameworkBuildHost;
}

private static void AssertBuildHostExists(string buildHostPath)
{
if (!File.Exists(buildHostPath))
throw new Exception(string.Format(WorkspaceMSBuildResources.The_build_host_could_not_be_found_at_0, buildHostPath));
}

private void AppendBuildHostCommandLineArgumentsConfigureProcess(ProcessStartInfo processStartInfo)
{
foreach (var globalMSBuildProperty in _globalMSBuildProperties)
Expand Down
3 changes: 3 additions & 0 deletions src/Workspaces/Core/MSBuild/WorkspaceMSBuildResources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -168,4 +168,7 @@
<data name="Path_for_additional_document_0_was_null" xml:space="preserve">
<value>Path for additional document '{0}' was null}</value>
</data>
<data name="The_build_host_could_not_be_found_at_0" xml:space="preserve">
<value>The build host could not be found at '{0}'</value>
</data>
</root>

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.