Closed
Description
Today in order to compare runtimes, I need to build against a single runtime (the lowest common denominator) with -f and then I can execute against multiple runtimes with --runtimes. That works in the majority use case, however sometimes you want to answer the question "how does this code compare on different runtimes?", and that includes compile-time impact due to new overloads being introduced, which necessitates building against the appropriate reference assemblies for each version.
Metadata
Metadata
Assignees
Labels
No labels
Activity
timcassell commentedon Sep 11, 2021
Possibly related? It would be nice to be able to recompile targets with different versions of a library/dll. Currently, I can use 2 different versions of the same library in separate projects, both projects referenced by the benchmark project and each called with a different benchmark method, and that compiles just fine, but fails at runtime with
System.Reflection.TargetInvocationException
.I'm not sure how that could be achieved, considering I have to include the references in the csproj itself.
timcassell commentedon Jul 15, 2023
This is already working for Core runtimes. I sent a PR to fix this for Framework in #2370. I'm also aware of classic Mono not being able to rebuild per target framework, but I'm not sure if we need to add that support. Do you need that, and are there any other runtimes that need this and are not already being rebuilt @stephentoub?
stephentoub commentedon Jul 17, 2023
core and framework are the two I've personally cared about.
stephentoub commentedon Aug 2, 2023
@timcassell, can you clarify what you mean about this already working for Core? I'm not seeing that. I see a project get build that targets the original .dll and whatever target it was built for.
timcassell commentedon Aug 2, 2023
@stephentoub I added tests showing that we are recompiling. Can you share a repro of what you are seeing?
stephentoub commentedon Aug 2, 2023
nuget.config:
Program.cs
Benchmarks.csproj
Then run with:
That last line should be closer to 60ns if it were actually being compiled as desired, and if you add
<EnableConfigurationBindingGenerator>true</EnableConfigurationBindingGenerator>
to the PropertyGroup in the csproj, you'll see it drops to that (but so does the other .NET 8 row).timcassell commentedon Aug 2, 2023
Oh I see, that's a separate issue. #1377
stephentoub commentedon Aug 2, 2023
If I
--keepFiles
, I see the supplied argument being passed to thedotnet build
command in the generated.bat
file, but that's not the project that needs the argument.timcassell commentedon Aug 2, 2023
Do you know how to pass it to the proper project? I couldn't figure it out. When I tried it without BDN, it was passed to both projects, but with BDN it doesn't seem to work.
stephentoub commentedon Aug 2, 2023
Nope 😦
6 remaining items