Add RuntimeInformation.RuntimeIdentifier#34206
Conversation
This value returns the Runtime Identifier (RID) of the current machine. Contributes to dotnet#26780
|
Note regarding the This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, to please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change. |
...ntimeInformation/src/System/Runtime/InteropServices/RuntimeInformation/RuntimeInformation.cs
Outdated
Show resolved
Hide resolved
...ntimeInformation/src/System/Runtime/InteropServices/RuntimeInformation/RuntimeInformation.cs
Show resolved
Hide resolved
...ntimeInformation/src/System/Runtime/InteropServices/RuntimeInformation/RuntimeInformation.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Runtime.InteropServices.RuntimeInformation/tests/RuntimeIdentifierTests.cs
Outdated
Show resolved
Hide resolved
|
@eerhardt @rainersigwald can we make that property readable from msbuild as a property function?
from https://devblogs.microsoft.com/visualstudio/msbuild-property-functions/. Sounds to me like we need to "white-list" that property? That information could be outdated as I see that we are reading other properties from RuntimeInformation already: |
It is already possible today (since this property is on RuntimeInformation): <PropertyGroup>
<MyRid>$([System.Runtime.InteropServices.RuntimeInformation]::RuntimeIdentifier)</MyRid>
</PropertyGroup>
<Target Name="PostBuild"
AfterTargets="Build">
<Message Text="Current RID: $(MyRid)" Importance="high" />
</Target>On my machine outputs: However, note that this will only work from MSBuild running on .NET 5 and above, since this API is only available there. It won't work on .NET Core 3.x, nor will it work on MSBuild running on .NET Framework. |
|
Great, thanks! |
This value returns the Runtime Identifier (RID) of the current machine.
Contributes to #26780
Most of the tests are disabled because we use an old host to run our tests. When we update to a host with the new code, the tests can be enabled. I'll keep #26780 open until the tests are enabled.