Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FS0039 Configure is not defined #415

Closed
jtourlamain opened this issue May 4, 2020 · 2 comments
Closed

FS0039 Configure is not defined #415

jtourlamain opened this issue May 4, 2020 · 2 comments

Comments

@jtourlamain
Copy link
Contributor

I tried to create a new Giraffe project via the manual steps.

To reproduce:

  • Create a new dotnet core console app in visual studio (dotnet core 3.1)
  • Add Giraffe NuGet (4.1.0)
  • Update Program.fs with:
module Firaffe
open System
open Microsoft.AspNetCore.Builder
open Microsoft.Extensions.Hosting
open Microsoft.Extensions.DependencyInjection
open Giraffe

let webApp =
    choose [
        route "/ping"   >=> text "pong"
        route "/"       >=> htmlFile "/pages/index.html" ]

let configureApp (app : IApplicationBuilder) =
    // Add Giraffe to the ASP.NET Core pipeline
    app.UseGiraffe webApp

let configureServices (services : IServiceCollection) =
    // Add Giraffe dependencies
    services.AddGiraffe() |> ignore

[<EntryPoint>]
let main _ =
    Host.CreateDefaultBuilder()
        .ConfigureWebHostDefaults(
            fun webHostBuilder ->
                webHostBuilder
                    .Configure(configureApp)
                    .ConfigureServices(configureServices)
                    |> ignore)
        .Build()
        .Run()  
    0 // return an integer exit code

Trying to compile the code gives the "FS0039" error on line with .Configure(configureApp)
What did I miss to get this error?

@tangledupinblue
Copy link

I had the same issue, it just turned out to be a missing dependency.

Dependencies should be:

open System
open Microsoft.AspNetCore.Builder
open Microsoft.AspNetCore.Hosting
open Microsoft.Extensions.Hosting
open Microsoft.Extensions.DependencyInjection
open Giraffe

This is for the second, functional startup example on README.

For the first example there are also missing dependencies (for logging and core hosting). These should be:

open System
open Microsoft.AspNetCore.Builder
open Microsoft.AspNetCore.Hosting
open Microsoft.Extensions.Hosting
open Microsoft.Extensions.Logging
open Microsoft.Extensions.DependencyInjection
open Giraffe

@jtourlamain
Copy link
Contributor Author

@tangledupinblue thank you so much. That did the trick! Weird that Visual Studio doesn't offer to add the missing dependency.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants