-6

.Net Standard is used to can be use the same library in different type of projects, such as WPF, xamarin, UWP... etc.

.Net Core can't by default, but there is the possibility to configure the multi target in .net Core editing the csproj file, so I can set multiple targets. In one test that I have done, if I set as target net47, I can use this .net Core library in my WPF project.

So if I can do the same with .net Core multi target and with .net standard. What are the differences and when to use one and when to use other?

Thanks.

Álvaro García
  • 18,114
  • 30
  • 102
  • 193
  • 1
    Could you stop to post the same question again and again? With this we are at 4. – Steve May 21 '17 at 09:02
  • It is not the same question, the first question was generic and this I asked about an specific feature of .net Core, the multi target. In the first question nobody mention about multi target, so if you could me tell how I would ask about this in the same question, I will thank you. – Álvaro García May 21 '17 at 09:39
  • 3
    It's not "multi target in .NET Core" - it would be having multiple targets in one csproj file, *one of which* might be .NET Core, with others being .NET Standard, etc. – Jon Skeet May 21 '17 at 11:11
  • 1
    It would be a lot clearer if you would say what you're trying to achieve. – Jon Skeet May 21 '17 at 11:31

1 Answers1

4

You would need to target multiple frameworks in the csproj file. In the original launch of Visual Studio 2017 there's no UI for this, but you can do it manually. I believe that there will be UI support for this in an update.

It's just a matter of changing the <TargetFramework> element to <TargetFrameworks> and using a semi-colon-separated list of targets. For example, in Noda Time I have:

<TargetFrameworks>net45;netstandard1.3</TargetFrameworks>

You could have:

<TargetFrameworks>netcoreapp1.0;netstandard1.3</TargetFrameworks>

However, you'd only want to do this if you wanted to take advantage (conditionally) of some features that are only available in .NET Core, and not in .NET Standard.

Jon Skeet
  • 1,421,763
  • 867
  • 9,128
  • 9,194