Skip to content

Commit

Permalink
Tmds.DBus.Protocol: drop dependency on System.Security.Principal.Wind…
Browse files Browse the repository at this point in the history
…ows. (#186)
  • Loading branch information
tmds committed Mar 9, 2023
1 parent bd09afb commit bb1a3d6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/Tmds.DBus.Protocol/DBusEnvironment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ static class DBusEnvironment
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
#if NET6_0_OR_GREATER
return System.Security.Principal.WindowsIdentity.GetCurrent().User?.Value;
#else
throw new NotSupportedException("Cannot determine Windows UserId. You must manually assign it.");
#endif
}
else
{
Expand Down
5 changes: 3 additions & 2 deletions src/Tmds.DBus.Protocol/Tmds.DBus.Protocol.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1</TargetFrameworks>
<TargetFrameworks>netstandard2.0;netstandard2.1;net6.0</TargetFrameworks>
<Nullable>enable</Nullable>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>10</LangVersion>
Expand All @@ -24,8 +24,9 @@

<ItemGroup>
<PackageReference Include="Nerdbank.Streams" Version="2.9.112" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETStandard'">
<PackageReference Include="System.Threading.Channels" Version="7.0.0" />
<PackageReference Include="System.Security.Principal.Windows" Version="5.0.0" />
</ItemGroup>

</Project>

0 comments on commit bb1a3d6

Please sign in to comment.