12

I read up on the new .NET Platform Standard concept replacing the old Portable Class Libraries, which seems nice. However, I can't seem to figure out how to create such a library, yet.

Is there a Project Template for Visual Studio where I could choose the target generation / netstandard? Or do I have to manually change a PCL project.json file for this?

(Got VS15, Update 3 installed)

3
  • 2
    If you create a PCL project and then double click properties, you should see an option to change your target platform. That will let you choose a .net standard version. Same thing as doing it yourself in the project.json but is the closest thing I have found so far to having a VS template do it for you Commented Aug 3, 2016 at 23:43
  • Though I'm not sure if that is built into VS2015 update 3 or if that came when I installed the .net core tooling preview 2 Commented Aug 3, 2016 at 23:53
  • 2
    Seems to do the trick for now, will gladly accept as answer Commented Aug 3, 2016 at 23:57

4 Answers 4

8

If you create a PCL project and then double click properties, you should see an option to change your target platform. That will let you choose a .net standard version. Same thing as doing it yourself in the project.json but is the closest thing I have found so far to having a VS template do it for you

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

5 Comments

@Thomas how has that been working for you? I've found it annoying recently - I had several PCL->netstandard projects that were later added to a private nuget feed as well as referenced by other netcore apps in the solution. The references seemed to get all tied up, depending on if you added it through nuget, right click->add project reference, or directly in the project.json. Had project.json/.csproj/.xproj all getting edited and not playing well together, and sometimes you could compile through VS but not through dotnet build or vice versa
@Thomas I ended up just going with netcore class libraries and adjusting the project.json to the correct netstandard framework. That process just creates a project.json and .xproj, no csproj. Have you had anything like that happen?
Not yet, but I didn't go that deep into it just yet - for now it's just one package.
What do you mean double click properties? Properties of what?
It has been a while since this answer, and I think it is pretty much fully out of date. I don't remember exactly what properties I was clicking on, but it might have been the project itself in the solution explorer or something? But either way this was talking about how to create a netstandard project back in the preview days of .net core and before VS had as much support for it. Nowadays you can just create "New Class Library" and set your target framework to net5.0 or netstandard2.0 etc directly in the csproj
2

On Visual Studio 2019 it is possible to create projects that target .NET standard, just as you create another type of project. To do so, you just need to add new project, and then if you search for .net standard it will show several types of projects in which you can target .NET standard, as shown below.

enter image description here

Comments

1

You can follow this Create .NET Standard Packages with Visual Studio 2015

From the article:

This guide will walk you through creating a nuget package targeting .NET Standard Library 1.4. This will work across .NET Framework 4.6.1, Universal Windows Platform 10, .NET Core, and Mono/Xamarin.

2 Comments

Link only answers are auto flagged as low quality and as such are discouraged. Instead, you should extract the relevant parts of the linked-to resource into your answer in quotes, and provide accreditation where necessary.
@tomredfern actually all the information in the link is about all the steps needed to achieve what he want and answer his exact question and mine when i get cross his question and contained searching when i didn't find the answer. flagging my answer like this is just unfair because the data in the link from Microsoft it can't be reduced into smaller steps
0

You can also create new .NET Platform Standard projects from a template by using Visual Studio 2017 RC.

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.