简体   繁体   中英

How to create an F# library with target framework as .NET Standard 2.0?

I am trying to create an F# class library with target framework as .NET Standard 2.0. When I try to create a new project in Visual Studio 2017, I don't see any option to create a class library with target framework as .NET Standard 2.0 (attached screenshot) 在此处输入图片说明

When trying to create an F# project, I see a bunch of options to create projects in .NET framework or the option to create an ASP.NET Core web application (which uses .NET Core).

Can someone help me how to create an F# library with target framework as .NET Standard 2.0?

You don't normally directly target .NET Standard when creating project, with class libraries being the exception. .NET Standard is a specification that the different .NET platforms implement. For example, if you were creating a new asp.net project that targets .NET Core, you would need to target .Net Core 2.0 in order to indirectly target .NET Standard 2.0.

The following link explains this further and also shows the version of .NET Standard supported by each .Net platform:

https://docs.microsoft.com/en-us/dotnet/standard/net-standard

When creating class libraries, you can choose to directly target .NET Standard by following these steps (Visual Studio 2017):

  1. From the File >> New >> Project dialog, expand the tree for your desired language (in your case F#).
  2. Select the .NET Standard node.
  3. Select 'Class Library (.NET Standard)' as a project type.

新建项目对话框

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM