加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
openEuler-sdk-8.patch 3.33 KB
一键复制 编辑 原始数据 按行查看 历史
Wang Kui 提交于 2024-09-12 14:16 . fix Razor compile failed issue
diff --git a/src/Cli/dotnet/CommonOptions.cs b/src/Cli/dotnet/CommonOptions.cs
index 3547fd5..8613529 100644
--- a/src/Cli/dotnet/CommonOptions.cs
+++ b/src/Cli/dotnet/CommonOptions.cs
@@ -4,6 +4,7 @@
using Microsoft.DotNet.Cli.Utils;
using Microsoft.DotNet.Tools;
using Microsoft.DotNet.Tools.Common;
+using System.IO;
using System.CommandLine;
using System.CommandLine.Completions;
@@ -222,7 +223,7 @@ internal static string ResolveRidShorthandOptionsToRuntimeIdentifier(string os,
{
var currentRid = GetCurrentRuntimeId();
arch = arch == "amd64" ? "x64" : arch;
- os = string.IsNullOrEmpty(os) ? GetOsFromRid(currentRid) : os;
+ os = string.IsNullOrEmpty(os) ? GetCurrentOs(currentRid) : os;
arch = string.IsNullOrEmpty(arch) ? GetArchFromRid(currentRid) : arch;
return $"{os}-{arch}";
}
@@ -249,6 +250,30 @@ public static string GetCurrentRuntimeId()
return currentRuntimeIdentifiers[0]; // First rid is the most specific (ex win-x64)
}
+ private static string GetCurrentOs(string rid)
+ {
+ string osReleasePath = "/etc/os-release";
+ string id = null, versionId = null;
+ if (File.Exists(osReleasePath))
+ {
+ var lines = File.ReadLines(osReleasePath);
+ foreach (var line in lines)
+ {
+ if (line.StartsWith("ID=", StringComparison.Ordinal))
+ id = line.Substring(3).Trim('"', '\'');
+ if (line.StartsWith("VERSION_ID=", StringComparison.Ordinal))
+ versionId = line.Substring(11).Trim('"', '\'');
+ }
+ }
+ string result = null;
+ if (id == null)
+ return GetOsFromRid(rid);
+ result = id;
+ if (versionId != null)
+ result = $"{id}.{versionId}";
+ return result.ToLower();
+ }
+
private static string GetOsFromRid(string rid) => rid.Substring(0, rid.LastIndexOf("-"));
private static string GetArchFromRid(string rid) => rid.Substring(rid.LastIndexOf("-") + 1, rid.Length - rid.LastIndexOf("-") - 1);
diff --git a/src/Layout/redist/targets/GenerateLayout.targets b/src/Layout/redist/targets/GenerateLayout.targets
index eab01ef..e582384 100644
--- a/src/Layout/redist/targets/GenerateLayout.targets
+++ b/src/Layout/redist/targets/GenerateLayout.targets
@@ -135,9 +135,17 @@
BeforeTargets="Build">
<ItemGroup>
<WebSdkProjectFile Include="$(RepoRoot)src\WebSdk\**\*.csproj" />
+ <BlazorWebAssemblyProjectFile Include="$(RepoRoot)src\BlazorWasmSdk\**\*.csproj" />
+ <RazorProjectFile Include="$(RepoRoot)src\RazorSdk\**\*.csproj" />
+ <StaticWebAssetskProjectFile Include="$(RepoRoot)src\StaticWebAssetsSdk\**\*.csproj" />
+ <WebAssemblyProjectFile Include="$(RepoRoot)src\WasmSdk\**\*.csproj" />
</ItemGroup>
<MSBuild Projects="@(WebSdkProjectFile)" />
+ <MSBuild Projects="@(BlazorWebAssemblyProjectFile)" />
+ <MSBuild Projects="@(RazorProjectFile)" />
+ <MSBuild Projects="@(StaticWebAssetskProjectFile)" />
+ <MSBuild Projects="@(WebAssemblyProjectFile)" />
<PropertyGroup>
<NETSdkSourceRoot>$(ArtifactsBinDir)$(Configuration)\Sdks\Microsoft.NET.Sdk</NETSdkSourceRoot>
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化