首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在mac上编译任何版本的F#?

如何在mac上编译任何版本的F#?
EN

Stack Overflow用户
提问于 2021-01-04 14:18:02
回答 1查看 141关注 0票数 2

(我知道现有的堆栈溢出问题如何在Mac上使用F# 4.7?非常相似,但不完全相同,而且还没有解决方案)

在我的mac (Catalina10.15.7)上,我通过这个.NET没有问题地安装了这个链接内核。

命令

代码语言:javascript
复制
dotnet --help

正确返回帮助。

当尝试初始化一个新项目时,它会失败,因为:

代码语言:javascript
复制
$ dotnet new –lang f#
Getting ready...
Couldn't find an installed template that matches the input, searching online for one that does...
No templates found matching: '–lang'.

$ dotnet new --lang "f#"
Invalid input switch:
  --lang
  f#
Run dotnet new --help for usage information.
See https://aka.ms/dotnet-install-templates to learn how to install additional template packs.

那么,如何在mac上启动项目或运行F#文件呢?是否有最新的博客文章提供了安装F#编译器的教程?

-编辑-编辑

命令dotnet new返回:

代码语言:javascript
复制
$ dotnet new
Templates                                         Short Name          Language          Tags                  
--------------------------------------------      --------------      ------------      ----------------------
Console Application                               console             [C#], F#, VB      Common/Console        
Class library                                     classlib            [C#], F#, VB      Common/Library        
Worker Service                                    worker              [C#], F#          Common/Worker/Web     
Unit Test Project                                 mstest              [C#], F#, VB      Test/MSTest           
NUnit 3 Test Project                              nunit               [C#], F#, VB      Test/NUnit            
NUnit 3 Test Item                                 nunit-test          [C#], F#, VB      Test/NUnit            
xUnit Test Project                                xunit               [C#], F#, VB      Test/xUnit            
Razor Component                                   razorcomponent      [C#]              Web/ASP.NET           
Razor Page                                        page                [C#]              Web/ASP.NET           
MVC ViewImports                                   viewimports         [C#]              Web/ASP.NET           
MVC ViewStart                                     viewstart           [C#]              Web/ASP.NET           
Blazor Server App                                 blazorserver        [C#]              Web/Blazor            
Blazor WebAssembly App                            blazorwasm          [C#]              Web/Blazor/WebAssembly
ASP.NET Core Empty                                web                 [C#], F#          Web/Empty             
ASP.NET Core Web App (Model-View-Controller)      mvc                 [C#], F#          Web/MVC               
ASP.NET Core Web App                              webapp              [C#]              Web/MVC/Razor Pages   
ASP.NET Core with Angular                         angular             [C#]              Web/MVC/SPA           
ASP.NET Core with React.js                        react               [C#]              Web/MVC/SPA           
ASP.NET Core with React.js and Redux              reactredux          [C#]              Web/MVC/SPA           
Razor Class Library                               razorclasslib       [C#]              Web/Razor/Library     
ASP.NET Core Web API                              webapi              [C#], F#          Web/WebAPI            
ASP.NET Core gRPC Service                         grpc                [C#]              Web/gRPC              
dotnet gitignore file                             gitignore                             Config                
global.json file                                  globaljson                            Config                
NuGet Config                                      nugetconfig                           Config                
Dotnet local tool manifest file                   tool-manifest                         Config                
Web Config                                        webconfig                             Config                
Solution File                                     sln                                   Solution              
Protocol Buffer File                              proto                                 Web/gRPC              

Examples:
    dotnet new mvc --auth Individual
    dotnet new web 
    dotnet new --help
    dotnet new classlib --help
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-01-04 14:21:13

在从网站复制时要小心格式化

问题的–lang中的破折号不是减号-,而是恩达什。我怀疑您从一个网站复制了这个命令,该网站用一个en破折号替换了减号。这类似于用排版引号替换"'的站点。

直接键入命令,而不是粘贴它。

原始答案

new没有--lang选项。尝试-lang--language列出一种语言的所有可用模板。若要指定f#类型f#,例如:

代码语言:javascript
复制
> dotnet new -lang f#
These templates matched your input: language='f#'.

Templates                       Short Name      Language      Tags
--------------------------      ----------      --------      -----------------
Console Application             console         F#            Common/Console
Class library                   classlib        F#            Common/Library
Worker Service                  worker          F#            Common/Worker/Web
Unit Test Project               mstest          F#            Test/MSTest
NUnit 3 Test Project            nunit           F#            Test/NUnit
NUnit 3 Test Item               nunit-test      F#            Test/NUnit
xUnit Test Project              xunit           F#            Test/xUnit
ASP.NET Core Empty              web             F#            Web/Empty
ASP.NET Core Web App (M...      mvc             F#            Web/MVC
ASP.NET Core Web API            webapi          F#            Web/WebAPI
票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65564196

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档