Skip to content

Commit f76cfa2

Browse files
committed
feat: update ApplicationHelper RuntimeInfo
1 parent 8699905 commit f76cfa2

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

src/WeihanLi.Common/Helpers/ApplicationHelper.cs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,6 @@ public static LibraryInfo GetLibraryInfo(Assembly assembly)
8686

8787
public static string GetDotnetDirectory()
8888
{
89-
var environmentOverride = Environment.GetEnvironmentVariable("DOTNET_MSBUILD_SDK_RESOLVER_CLI_DIR");
90-
if (!string.IsNullOrEmpty(environmentOverride))
91-
{
92-
return environmentOverride;
93-
}
94-
9589
var dotnetExe = GetDotnetPath();
9690

9791
if (dotnetExe.IsNotNullOrEmpty() && !InteropHelper.RunningOnWindows)
@@ -162,6 +156,7 @@ private static RuntimeInfo GetRuntimeInfo()
162156
OSDescription = RuntimeInformation.OSDescription,
163157
OSVersion = Environment.OSVersion.ToString(),
164158
MachineName = Environment.MachineName,
159+
UserName = Environment.UserName,
165160

166161
IsInContainer = IsInContainer(),
167162
IsInKubernetes = IsInKubernetesCluster(),
@@ -229,6 +224,7 @@ public sealed class RuntimeInfo : LibraryInfo
229224
public required string OSDescription { get; init; }
230225
public required string OSVersion { get; init; }
231226
public required string MachineName { get; init; }
227+
public required string UserName { get; init; }
232228

233229
#if NET6_0_OR_GREATER
234230
public required string RuntimeIdentifier { get; init; }

test/WeihanLi.Common.Test/HelpersTest/ApplicationHelperTest.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@ public void DotnetPathTest()
1313
var dotnetPath = ApplicationHelper.GetDotnetPath();
1414
Assert.NotNull(dotnetPath);
1515
Assert.NotEmpty(dotnetPath);
16+
Assert.True(File.Exists(dotnetPath));
1617
}
1718
}

0 commit comments

Comments
 (0)