2

Today I decided to create a new ASP.NET Core 1.0.1 application using the Visual Studio 2017 RC Empty template. The application runs and all goes well. Note though that this is the first time I use the all new .NET Core.

Then I decided I want to use EntityFramework 6.x and not EF Core because I am bound to using Oracle instead of SQL Server. Unfortunately, I have spent hours looking at the documentation, blog posts and StackOverflow questions but I still couldn't get it to work.

From what I've read, ASP.NET Core started out with a project.json file which then got deprecated (correct me if I'm wrong...) and all the documentation and content online seem to propose solutions using this file.

Accordingly:

  1. Is targeting multiple versions of the .NET framework (Core and 4.6.x) still possible now that the project.json is gone? If so, how?
  2. Can I still use the project.json anyway?!

UPDATE:

Some of the issues I'm facing are the following:

  • I created a class library called "Shared". The type of the project was .NET Standard. I referenced it in the ASP.NET Core application and it worked fine. Then I referenced it from a web application which targets .NET 4.5.2 and I got this error: Project Shared is not compatible with net452 (.NETFramework,Version=v4.5.2) / win7-x86. Project Shared supports: netstandard1.4 (.NETStandard,Version=v1.4)
  • I tried to install the EntityFramework 6.x Nuget package into the ASP.NET Core application, but I got this error: One or more packages are incompatible with .NETCoreApp,Version=v1.0.

I guess if someone would point me in the right direction on where to read reliable/up-to-date documentation that would be great. I need to understand what and why this is happening so I can take it from there.

8
  • what error are you getting? Commented Jan 5, 2017 at 19:43
  • @Mike_G: the error I'm getting is this "One or more packages are incompatible with .NETCoreApp,Version=v1.0." Commented Jan 5, 2017 at 19:48
  • Off topic : since you try a new project on new versions, why don't you try version 1.1.0? In topic : you should post your project.json file, it may help ! Commented Jan 5, 2017 at 21:15
  • Duplicate: stackoverflow.com/q/38267723/861716 Commented Jan 5, 2017 at 21:50
  • @kall2sollies: I actually tried that. I used Nuget to update the packages to the latest version right after creating the empty project. Once I did that, the application stopped running: as if a console application has run and then closed. I thought that might be a bug in the tooling since it's not an RTM version of Visual Studio 2017 yet. Commented Jan 6, 2017 at 8:30

1 Answer 1

2

Is targeting multiple versions of the .NET framework (Core and 4.6.x) still possible now that the project.json is gone? If so, how?

You can specify multiple version in csproj like below-

Example1:

<TargetFrameworks>netcoreapp1.0;net452</TargetFrameworks>

Example2:

<TargetFrameworks>netcoreapp1.1;net462</TargetFrameworks>

Refer Cross-targeting section.

Can I still use the project.json anyway?

You can easily migrate using dotnet migrate command. This command generates the exact same csproj file from existing project.json.

Refer Project Migration section.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.