Skip to content

Add use-current-runtime test #170

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 8, 2021

Conversation

tmds
Copy link
Member

@tmds tmds commented Oct 15, 2021

Fixes #169.

@tmds tmds requested a review from omajid October 15, 2021 07:06
@omajid
Copy link
Member

omajid commented Oct 25, 2021

I tried out this test against an RC2 build of source-build with dotnet/sdk#21748 applied manually. It doesn't pass:

$ dotnet build --use-current-runtime
Microsoft (R) Build Engine version 17.0.0-preview-21501-01+bbcce1dff for .NET
Copyright (C) Microsoft Corporation. All rights reserved.

  Determining projects to restore...
  Restored /home/omajid/temp/CurrentRuntime/CurrentRuntime.csproj (in 29.47 sec).
  You are using a preview version of .NET. See: https://aka.ms/dotnet-core-preview
  CurrentRuntime -> /home/omajid/temp/CurrentRuntime/bin/Debug/net6.0/fedora.34-x64/CurrentRuntime.dll

Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:31.44

$ dotnet publish --use-current-runtime
Microsoft (R) Build Engine version 17.0.0-preview-21501-01+bbcce1dff for .NET
Copyright (C) Microsoft Corporation. All rights reserved.

  Determining projects to restore...
  All projects are up-to-date for restore.
  You are using a preview version of .NET. See: https://aka.ms/dotnet-core-preview
  CurrentRuntime -> /home/omajid/temp/CurrentRuntime/bin/Debug/net6.0/fedora.34-x64/CurrentRuntime.dll
  CurrentRuntime -> /home/omajid/temp/CurrentRuntime/bin/Debug/net6.0/fedora.34-x64/publish/

Trying to debug this some more:

The msbuild property is set when running msbuild:

$ dotnet build -v:diag --use-current-runtime                                       
Microsoft (R) Build Engine version 17.0.0-preview-21501-01+bbcce1dff for .NET                                         
Copyright (C) Microsoft Corporation. All rights reserved.                                                             
                                                                                                                      
/usr/lib64/dotnet/sdk/6.0.100-rc.2.21505.1/MSBuild.dll -consoleloggerparameters:Summary -maxcpucount -property:UseCurrentRuntimeIdentifier=True -restore -verbosity:m -verbosity:diag ./CurrentRuntime.csproj

And msbuild uses it to set up RuntimeIdentifier:

$ dotnet build --use-current-runtime /pp
[...]
  <PropertyGroup Condition="'$(UseCurrentRuntimeIdentifier)' == 'true'" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <RuntimeIdentifier>$(NETCoreSdkPortableRuntimeIdentifier)</RuntimeIdentifier>
  </PropertyGroup>
[...]

But build -v:diag also shows that the portable id is is fedora.34-x64, not linux-x64 as expected:

                   NetCoreRoot = /usr/lib64/dotnet/
                   NETCoreSdkBundledCliToolsProps = /usr/lib64/dotnet/sdk/6.0.100-rc.2.21505.1/Sdks/Microsoft.NET.Sdk/targets/../../../Microsoft.NETCoreSdk.BundledCliTools.props
                   NETCoreSdkBundledVersionsProps = /usr/lib64/dotnet/sdk/6.0.100-rc.2.21505.1/Sdks/Microsoft.NET.Sdk/targets/../../../Microsoft.NETCoreSdk.BundledVersions.props
                   NETCoreSdkPortableRuntimeIdentifier = fedora.34-x64
                   NETCoreSdkRuntimeIdentifier = fedora.34-x64
                   NETCoreSdkVersion = 6.0.100-rc.2.21505.1

@tmds
Copy link
Member Author

tmds commented Oct 26, 2021

the portable id is is fedora.34-x64, not linux-x64 as expected

🙄

... the test works!

@omajid omajid merged commit 867b2a8 into redhat-developer:main Dec 8, 2021
@ayakael
Copy link
Contributor

ayakael commented Mar 16, 2022

@omajid Indeed the test works! On Alpine NETCoreSdkPortableRuntimeIdentifier = alpine.3.15-x64. Did you ever figure out a fix?

@ayakael ayakael mentioned this pull request Mar 16, 2022
@omajid
Copy link
Member

omajid commented Mar 17, 2022

I think it was dotnet/sdk#22373 + dotnet/installer#12516 that fixed it. Both of them are merged for 6.0.2xx, but not for 6.0.1xx, so we carry those as patches in Fedora.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a test for --use-current-runtime
3 participants