Open ghost opened 6 years ago
Please get this merged. This is very important for all of us going forward.
@reedmclean It should be trivial to make the code compile both .NET 4.5 and .NET Core assemblies. We've done it in the past quite easily.
@JohnGalt1717, that's good to hear! Would we have to release two builds with different targets, or would one build work in both 4.5 and .NET Core applications?
@reedmclean All that you have to do is add multiple targets like this:
<TargetFrameworks>netstandard1.1;net452</TargetFrameworks>
Then Setup property groups to define compiler variables for anything that is unique between the two (don't think there is but...)
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
</ItemGroup
<ItemGroup Condition="'$(TargetFramework)' == 'net452'">
</ItemGroup>
You can also put your nuget packages in each of those as package references so you get the right ones for the right assemblies.
Then when you build you'll end up with 2 directories in the bin folder and you can nuget publish and it will show as targeting both.
In code you can use #if(Variable) #else #12
If we can back off some of the stuff and use HttpClient this could target .NET Standard 1.6 which is compatible directly with .net 4.5.2 and then it would just work without any of the targeting. But Targetting might be cleaner.
This is a migration from .NET 3.5 to .NET Core 2. The migration was performed due to a need to use TinCan.NET on a ASP.NET Core project which runs on Linux. Creating this pull request as I rather not have to maintain a fork to support .NET Core. Please be explicit and reject this request in writing should you not want to support .NET Core.
Build confirmed to work on macOS, Linux and Windows. All tests pass except one, the one failing fails because TinCan.NET does not support xapi 1.0.3 (see https://github.com/RusticiSoftware/TinCan.NET/issues/27)