Matthias Burger
Matthias Burger

Reputation: 5956

.Net Core Library multiple target frameworks in VS2017

I'm trying to work with Visual Studio 2017. And maybe someone worked also with? I could not find much help for now.

So, I created a project as .NET Core Class Library.

In Visual Studio 2015 there were those project.json files containing the information with the target-frameworks. I could do s.th like:

"frameworks": {
    "netstandard1.5": { ...
      },
    "netstandard1.6": { ...
      },
    "netcoreapp1.0": { ...
      },
    "net45": { ...
      },
    "net451": { ...
      }
} and so on

now I created that project and there is that old *.csproj xml-file.

The xml uses:

<PropertyGroup>
    <TargetFramework>netcoreapp1.1</TargetFramework>
</PropertyGroup>

Upvotes: 1

Views: 1059

Answers (1)

Leo Liu
Leo Liu

Reputation: 76996

Isn't it possible to use the json-file again?

As far as I know, we could not use the project.json file in Visual Studio 2017. Because .Net Core is going to be based on msbuild, which means that it's going to use *.csproj instead of project.json.

Is it possible to add here more frameworks? Like Net45 and Net451,...?

Yes, Multi framework targetting is supported by the .net core in Visual Studhio 2017. We could add the net451,net461 in the TargetFramework:

  <PropertyGroup>
    <TargetFrameworks>netcoreapp1.1;net461</TargetFrameworks>
  <PropertyGroup>

If yes: How can I add the other (and old) dependencies? Like System.Data?

When you add the net461 TargetFramework, nuget will restore the packages automatically. After the recovery is complete, you will see the system.data.dll is added to the References:

enter image description here

Hope this can help you.

Upvotes: 3

Related Questions