dotnet / templating

This repo contains the Template Engine which is used by dotnet new
https://docs.microsoft.com/dotnet/
MIT License
1.63k stars 369 forks source link

F# mvc template? #3189

Closed S3j5b0 closed 3 years ago

S3j5b0 commented 3 years ago

Hi, i'm just getting started in playing with rider.

I'd really like to create a f# mvc application. When opening a project back in visual studio, it's pretty easy just to pick a a .net framework application and then pick mvc scaffolding.

Is there any way to do this easily with rider? I've followed the link from the ide that says "install template" but I can't find the simple mvc template i'm looking for

DavidKarlas commented 3 years ago

You probably need https://www.nuget.org/packages/Microsoft.DotNet.Web.ProjectTemplates.5.0/

S3j5b0 commented 3 years ago

Hm, just tried to install it. The output look like so;

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             
Giraffe                       giraffe         F#          Web/Giraffe/ASP.NET   
ASP.NET Core Web App (Mod...  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.j...  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 manifes...  tool-manifest               Config                
Web Config                    webconfig                   Config                
Solution File                 sln                         Solution              
Protocol Buffer File          proto                       Web/gRPC              

There does not seem to be any mvc template for F#

DavidKarlas commented 3 years ago

ASP.NET Core Web App (Mod... mvc [C#],F# Web/MVC

You can use dotnet new mvc -lang "F#" command to create F# mvc template.

S3j5b0 commented 3 years ago

Ok this works seamlessly! thanks a lot!

If you happen to know, or have the time to answer a dumb question, I have a quick one:

In the homecontroller, there is these two actions:


type HomeController (logger : ILogger<HomeController>) =
    inherit Controller()

    member this.Index () =
        this.View()

    member this.Privacy () =
        this.View()

Now, the index-action here, seems to work fine, and returns a corresponding view when I open https://localhost:5001

But if I I acces https://localhost:5001/Privacy then it can't find anything? what does the Privacy-action do?

DavidKarlas commented 3 years ago

https://docs.microsoft.com/en-us/aspnet/core/tutorials/first-mvc-app/adding-controller?view=aspnetcore-5.0&tabs=visual-studio has https://localhost:5001/Home/Privacy listed, try that, since you found a way to get template working I'm closing this issue.