Charstar
Charstar

Reputation: 136

.net core & .net framework in the same team

Our development team has many .net framework 4.6 projects (VS 2015). We want to start a new .net core project to eventually deploy on linux.

We have installed VS 2017 and the .net core 2.0 preview.

But how can we reuse the existing library projects in this new one ?

We research but it is not clear for us : - we need to change the target of the old projects from ".Net Framework 4.6" to ".NetStandard 1.x" ? (and solve the incompatibility) - or we can use them like that ? (but how?)

Thanks

Upvotes: 0

Views: 173

Answers (2)

omajid
omajid

Reputation: 15203

Microsoft publishes official guidelines for the porting process: https://learn.microsoft.com/en-us/dotnet/articles/core/porting/

To summarize:

  1. Deal with your dependencies (by migrating them), recursively
  2. Retarget your projects. Applications move to .NET core, libraries move to .NET Standard, where possible.
  3. Use some helpful tooling to verify your ports
  4. Test

So, to share things between .NET Framework and .NET Core, your libraries should target .NET Standard, as much as possible. Otherwise, you could possibly share the code and have to do multiple builds - build once targetting .NET Framework and again targetting .NET Core.

Upvotes: 3

Andrii Litvinov
Andrii Litvinov

Reputation: 13182

You can use/reference your old projects only if you target Full Framework in your new projects (which is not the case if you are going to run them on Linux).

If you started with preview you should convert you old projects to .Net Core projects and either target .NET Core 2.0 Preview or NetStandard 2.0 Preview. If you are not going to reference/use your old projects outside your application it might be better to target .NET Core 2.0 Preview because it might provide more API than NetStandard 2.0 Preview.

Upvotes: 0

Related Questions