Context
Using an API delivered as a COM reference, the goal is to build Windows-only applications targeting either .NET Framework 4.8 or .NET 6.
A library of helper methods around the API will be written and be reused across projects.
Question
What would be the best way to build this library, so that it could be used either in a .NET Framework 4.8 project or in a .NET 6 project?
So far here are the options I thought about:
Add as Link. You still need to perform the adding operation in the second project every time you create a new file in the first one, so it is not fully automated.Is there any better way to achieve this? Did I miss something?
I have a couple of projects that use COMReference. For multi-targeting different frameworks for these projects, I use the following, in my csproj file:
<TargetFrameworks>net472;net5.0-windows;net6.0-windows</TargetFrameworks>
net472, as well as, net48 is supposedly equivalent with netstandard2.0.
if going through nuget, nuget will attempt to match the correct dll out of the multi-pack bundle with the corresponding framework of the host application.