Skip to content

Conversation

@timcassell
Copy link
Collaborator

@timcassell timcassell commented Jan 23, 2024

Fixes #1197
Fixes #2344
Fixes #2371
Also fixes legacy packages.config issues with CsProjClassicNetToolchain (no open issue, but was mentioned in #2405 (comment)).
And this is a pre-requisite to adding support for extern alias (#2289).

@timcassell

This comment was marked as off-topic.

@timcassell timcassell marked this pull request as ready for review January 23, 2024 13:16
@timcassell
Copy link
Collaborator Author

@AndreyAkinshin Can we get this in v0.14.0 also? Then I can make a follow-up PR changing the default .Net Framework toolchain to CsProjClassicNetToolchain instead of RoslynToolchain (this fixes the issue we ran into when we tried to do that in v.0.13.7).

@AndreyAkinshin
Copy link
Member

@timcassell yes, we can, sorry for such a delay. I will check it out as soon as I have some time for that (I want to carefully review the changes, not just blindly merge it).

@Tampa
Copy link

Tampa commented Apr 11, 2024

@AndreyAkinshin It's been two months since. What's the status on this?

@timcassell

This comment was marked as outdated.

@timcassell
Copy link
Collaborator Author

I reverted my last commit because I forgot about the WithNuget feature. The feature makes it difficult to build the source project directly without generating our own csproj to reference it. Perhaps now that MsBuildArguments are stable we can remove the nuget feature and point users towards MSBuild properties. @adamsitnik @AndreyAkinshin Thoughts?

@timcassell
Copy link
Collaborator Author

@filzrev Failure looks like it's due to #2875. It succeeds on my local. Do you know how to fix it?

D:\a\BenchmarkDotNet\BenchmarkDotNet.dotnet\sdk\10.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(266,5): error NETSDK1005: Assets file 'D:\a\BenchmarkDotNet\BenchmarkDotNet\tests\BenchmarkDotNet.IntegrationTests\bin\Release\net8.0\BenchmarkDotNet.IntegrationTests-101\obj\BenchmarkDotNet.IntegrationTests\project.assets.json' doesn't have a target for 'net10.0'. Ensure that restore has run and that you have included 'net10.0' in the TargetFrameworks for your project. [D:\a\BenchmarkDotNet\BenchmarkDotNet\tests\BenchmarkDotNet.IntegrationTests\BenchmarkDotNet.IntegrationTests.csproj::TargetFramework=net10.0]

@filzrev
Copy link
Contributor

filzrev commented Dec 11, 2025

It seems Environment.Version/RuntimeInformation.FrameworkDescription returns actual runtime version (.NET 10). when .NET runtime version is roll forwarded.

It might need to resolve original tfm by using AppContext.TargetFrameworkName.

@timcassell
Copy link
Collaborator Author

It seems Environment.Version/RuntimeInformation.FrameworkDescription returns actual runtime version (.NET 10). when .NET runtime version is roll forwarded.

It might need to resolve original tfm by using AppContext.TargetFrameworkName.

I just pushed a fix using TargetFrameworkAttribute similar to ClrRuntime.GetTargetOrCurrentVersion. Is AppContext.TargetFrameworkName better?

@filzrev
Copy link
Contributor

filzrev commented Dec 11, 2025

I just pushed a fix using TargetFrameworkAttribute similar to ClrRuntime.GetTargetOrCurrentVersion. Is AppContext.TargetFrameworkName better?

It seems using TargetFrameworkAttribute internally.
https://source.dot.net/#System.Private.CoreLib/src/libraries/System.Private.CoreLib/src/System/AppContext.cs,a32225958db6c714

# Conflicts:
#	src/BenchmarkDotNet/Environments/Runtimes/CoreRuntime.cs
#	src/BenchmarkDotNet/Toolchains/DotNetCli/DotNetCliCommand.cs
@timcassell timcassell merged commit bd5ec34 into master Dec 11, 2025
16 checks passed
@timcassell timcassell deleted the references branch December 11, 2025 11:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

5 participants