nenoNaninu/Tapper

Keep .NET 6 support for Tapper class lib

Closed this issue · 4 comments

Thanks for sharing that api with the community. Would you accept a merge request which brings back .NET 6 support together (side by side) with .NET 7

That may be a bit difficult because of the Roslyn version and .NET version issues. For example, when .NET 7 was included in the environment, Tapper.Generator (CLI tool) did not work correctly when Tapper.Generator's TFM was set to .NET 6.

.NET 7 is required for the execution environment of Tapper.Generator (.NET tool), not your application. The Tapper.Generator work fine even if your application's TFM is set to .NET 6. The documentation may need to be clarified...

I considered to use the Tapper package as API. We are on the long-term-support releeases, currently .NET 6. A multitarget build of the Tapper project would be probably sufficient. But I think even the Tapper.Generator could be built multi-targeted (use multiple TargetFrameworks instead of just one). Based on the target framework it would be possible to reference different roslyn versions. And based on the default SDK on the target machine the global tool would either install the .NET6 or .NET7 version. We use for example docker in the pipelines and the docker container comes normally with just one SDK installed.

Here's a blog post that describes multi-target builds:
https://www.cafe-encounter.net/p2312/multi-targetting-net-framework-and-net-core-in-a-single-project
and here are some Microsoft docs about it:
https://learn.microsoft.com/en-us/nuget/create-packages/multiple-target-frameworks-project-file

I agree, we need .Net 6 support!

For a standard library that does not use Roslyn, I would also support both .NET 6 and .NET 7.
However, when .NET 7 was first released, I had problems with Tapper supporting .NET 6 and .NET 7.
Because of this, I dropped .NET 6.

Tapper project is intended to be used as a .NET tool (Tapper.Generator), not as a class lib (Tapper).
Tapper.Generator does not affect the TFM of the user's application (.NET 6 can be used because TFM of Tapper.Attributes is .NET standard2.0), and if you are using the latest version of Visual Studio, .NET 7 is always installed, so I thought there would be no problem.

When adding net6.0 to the Tapper (class lib) TFM, we have to assume a variety of user environments. And we need to prepare tests for that environments. So if you provide tests for the various environments that work fine, I will merge the PR.