I am really loving the new .csproj
format. It is so much better than that dreaded (limited) project.json
.
However, there is one thing that I am trying to work out. I have merged my (multiple) test projects into a single multi-targeted project.
<TargetFrameworks>netcoreapp1.0;net40;net35</TargetFrameworks>
But, there doesn't seem to be any tooling in Test Explorer in Visual Studio to select the target framework - it always just runs the first one. I found a workaround - to add a <TargetFramework>
element with a specific framework...
<TargetFramework>net35</TargetFramework>
But, is there any way to select the target framework without resorting to hand-editing the MSBuild (.csproj
) file? I am looking for some option in the GUI to do this - specifically so I don't have to remember to edit the .csproj
file in order to switch frameworks before debugging a test or to remember to have to remove this line before the release.
It turns out that Microsoft has finally fixed this in Visual Studio 2019 (not sure exactly when).
If you specify multiple target frameworks:
<TargetFrameworks>netcoreapp2.1;net451</TargetFrameworks>
The GUI now displays:
and lets you run tests on all target platforms at once.