Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migration from .NET 3.5 to .NET Core 2. #34

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open

Migration from .NET 3.5 to .NET Core 2. #34

wants to merge 11 commits into from

Conversation

ghost
Copy link

@ghost ghost commented Jan 23, 2018

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 #27)

@JohnGalt1717
Copy link

Please get this merged. This is very important for all of us going forward.

Copy link
Contributor

@reedmclean reedmclean left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delay on this @peturingi! We've been trying to find the time to better tend to our OSS repos, and hopefully I will be able to start weighing in on these more in the near future.

A few things:

  • It seems like this PR and ActivityDefinition InteractionType #35 have a lot of shared commits that span between updating this project to .NET Core and extending ActivityDefinition. These are two totally different pieces, so let's try and keep them separate. My gut is to keep Migration from .NET 3.5 to .NET Core 2. #34 for the .NET Core discussion and use ActivityDefinition InteractionType #35 to work on extending ActivityDefinition, but you can handle it however you want.
  • The three merge commits are unnecessary. Please rebase your current branch instead, it keeps the commit history clean and easily navigable.
  • Messing around with Rider's files isn't relevant to this. Happy to have them in the repo, but they're not part of the work to upgrade to .NET Core.
  • There are two commits that just edit the README, neither of which have meaningful commit messages. You could probably just squash all those changes into c09c088, or make a separate commit that just updates documentation.

We would have to release a new major version if we were to go down this path, and customers currently running on .NET 4.5 and below would not be able to move forward with us (I am admittedly not super familiar with the cross-compatibility details here, someone please correct me if I'm wrong on this). This is particularly troublesome for us because one of our products that relies on this library has a minimum supported .NET framework of 4.5, so if we changed this library to .NET Core, we would have to in turn raise the minimum framework for our dependent application.

I don't really want to leave older frameworks in the dust, but I also don't want to worry about supporting two branches for each target. We might try to get some of the currently pending issues into master first, and then we can do a new version targeting .NET Core 2. That way we don't leave apps on older frameworks without anything, but I guess that depends on how many people using this library with .NET Framework 3.5 plan on updating anytime soon.

I want to support .NET Core applications, but we might need to find a less disruptive way to go about that. I think that moving to .NET Standard 1.1 might be one way forward since it will let us keep the 4.5 minimum of our current product, but it will allow .NET Core 2 applications to use this repo. Anyone running a Framework version below 4.5 would have to update, but the usage numbers in that range might be low enough that it's doable.

I'll also talk a bit around here and see how flexible we are about the minimum support framework. If we can bump that up to 4.6.1 and we're okay with breaking this library for 4.5 and below, then migrating to .NET Core 2 or .NET Standard 2.0 could be a real possibility.

@@ -128,16 +98,9 @@
<Compile Include="Properties\AssemblyInfo.cs" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this file still present in the csproj file if you deleted it above? When I try to build your branch locally (dotnet --version is 2.0.3), one of the errors I get is that this file doesn't exist. Do you get any errors like that when you build this project?

@@ -1,26 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you delete the entire Doc directory? Granted, they're a little slim right now, but we still want to be able to easily add documentation in the future. Whenever we get there, we would have to recreate all of this.

@JohnGalt1717
Copy link

@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.

@reedmclean
Copy link
Contributor

@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?

@JohnGalt1717
Copy link

JohnGalt1717 commented Jul 30, 2018

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants