Skip to content
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

TFM patching bug when multiple TargetFramework(s) tags with conditions are present #662

Open
CarnaViire opened this issue Nov 23, 2023 · 0 comments

Comments

@CarnaViire
Copy link
Member

CarnaViire commented Nov 23, 2023

Microbenchmarks in Crank don't work for .NET 9.0 currently (logs):

Command:
dotnet publish MicroBenchmarks.csproj ....
....
error NETSDK1005: Assets file 'C:\Users\ .... \MicroBenchmarks\project.assets.json' doesn't have a target for 'net9.0'. Ensure that restore has run and that you have included 'net9.0' in the TargetFrameworks for your project.

The reason for that is a bug(?) when Crank is patching the TFM: it changes the first <TargetFrameworks> tag to just <TargetFramework> (without s) -- however, Microbenchmarks project file has some additional logic that depends on <TargetFrameworks> (with s) tag value being set (src):

    <!-- Used by Python script to narrow down the specified target frameworks to test, and avoid downloading all supported SDKs -->
    <TargetFrameworks>$(PERFLAB_TARGET_FRAMEWORKS)</TargetFrameworks>
    <!-- Supported target frameworks -->
    <TargetFrameworks Condition="'$(TargetFrameworks)' == '' AND '$(OS)' == 'Windows_NT'">net462;net6.0;net7.0;net8.0</TargetFrameworks>
    <TargetFrameworks Condition="'$(TargetFrameworks)' == '' AND '$(OS)' != 'Windows_NT'">net6.0;net7.0;net8.0</TargetFrameworks>

-- which results in <TargetFrameworks> being set by this logic, essentially overriding the TFM patch Crank did. This, by chance, was "working" for 8.0, because net8.0 was present in the resulted TFMs list, but it does not work for net9.0, which is not present there yet.

While Microbenchmarks could be updated to include 9.0 (I'm trying to do that in dotnet/performance#3504), the problem with the patching itself might resurface again -- in other projects, or in Microbenchmarks for vNext.

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

No branches or pull requests

1 participant