Merge branch 'release/7.0.3xx'

This commit is contained in:
Jason Zhai 2023-03-12 23:09:56 -07:00
commit 588cd23022
2 changed files with 30 additions and 0 deletions

View file

@ -15,9 +15,13 @@
<ItemGroup>
<!-- These packages will be replaced with ms-built packages downloaded from official package feeds-->
<PackageDownload Include="Microsoft.Aspnetcore.App.Runtime.linux-x64" Version="[$(MicrosoftAspNetCoreAppRuntimeVersion)]" />
<PackageDownload Include="Microsoft.AspNetCore.App.Runtime.linux-musl-x64" Version="[$(MicrosoftAspNetCoreAppRuntimeVersion)]" />
<PackageDownload Include="Microsoft.NETCore.App.Crossgen2.linux-x64" Version="[$(MicrosoftNETCoreAppCrossgen2Version)]" />
<PackageDownload Include="Microsoft.NETCore.App.Crossgen2.linux-musl-x64" Version="[$(MicrosoftNETCoreAppCrossgen2Version)]" />
<PackageDownload Include="Microsoft.NETCore.App.Host.linux-x64" Version="[$(MicrosoftNETCoreAppHostPackageVersion)]" />
<PackageDownload Include="Microsoft.NETCore.App.Host.linux-musl-x64" Version="[$(MicrosoftNETCoreAppHostPackageVersion)]" />
<PackageDownload Include="Microsoft.NETCore.App.Runtime.linux-x64" Version="[$(MicrosoftNETCoreAppRuntimeVersion)]" />
<PackageDownload Include="Microsoft.NETCore.App.Runtime.linux-musl-x64" Version="[$(MicrosoftNETCoreAppRuntimeVersion)]" />
<PackageDownload Include="Microsoft.NET.HostModel" Version="[$(MicrosoftNETHostModelVersion)]" />
<PackageDownload Include="Microsoft.NET.Sdk.IL" Version="[$(MicrosoftNETSdkILVersion)]" />
<PackageDownload Include="Microsoft.NETCore.ILAsm" Version="[$(MicrosoftNETCoreILAsmVersion)]" />

View file

@ -14,6 +14,7 @@ internal class DotNetHelper
{
private static readonly object s_lockObj = new();
private static bool IsMonoRuntime { get; } = DetermineIsMonoRuntime();
public static string DotNetPath { get; } = Path.Combine(Config.DotNetDirectory, "dotnet");
public static string LogsDirectory { get; } = Path.Combine(Directory.GetCurrentDirectory(), "logs");
public static string PackagesDirectory { get; } = Path.Combine(Directory.GetCurrentDirectory(), "packages");
@ -198,10 +199,13 @@ internal class DotNetHelper
public void ExecuteRunWeb(string projectName)
{
// 'dotnet run' exit code differs between CoreCLR and Mono (https://github.com/dotnet/sdk/issues/30095).
int expectedExitCode = IsMonoRuntime ? 143 : 0;
ExecuteCmd(
$"run {GetBinLogOption(projectName, "run")}",
GetProjectDirectory(projectName),
additionalProcessConfigCallback: processConfigCallback,
expectedExitCode,
millisecondTimeout: 30000);
void processConfigCallback(Process process)
@ -230,5 +234,27 @@ internal class DotNetHelper
return $"/bl:{Path.Combine(LogsDirectory, $"{fileName}.binlog")}";
}
private static bool DetermineIsMonoRuntime()
{
string dotnetRoot = Config.DotNetDirectory;
string sharedFrameworkRoot = Path.Combine(dotnetRoot, "shared", "Microsoft.NETCore.App");
if (!Directory.Exists(sharedFrameworkRoot))
{
return false;
}
string? version = Directory.GetDirectories(sharedFrameworkRoot).FirstOrDefault();
if (version is null)
{
return false;
}
string sharedFramework = Path.Combine(sharedFrameworkRoot, version);
// Check the presence of one of the mono header files.
return File.Exists(Path.Combine(sharedFramework, "mono-gc.h"));
}
private static string GetProjectDirectory(string projectName) => Path.Combine(ProjectsDirectory, projectName);
}