Reputation: 12681
This is my ASP.NET Core Web API entry-point:
open Microsoft.AspNetCore
open Microsoft.AspNetCore.Hosting
module Hosting =
let BuildWebHost args =
WebHost
.CreateDefaultBuilder(args)
.UseStartup<Startup>()
.UseIISIntegration()
.Build()
module Program =
let [<EntryPoint>] main args = Hosting.BuildWebHost(args).Run(); 0
This is from Program.fs
, the final file in my project.
After months of smooth compilation, I am suddenly getting the following compilation failure:
error FS0433: A function labeled with the 'EntryPointAttribute' attribute must be the last declaration in the last file in the compilation sequence.
It is the last declaration in the last file -- any idea why this might suddenly start failing now?
Upvotes: 4
Views: 1004
Reputation: 12681
This is because the user secrets infrastructure injects a file as the last file in the assembly. It is fixed in the next release of F#: see https://github.com/aspnet/Configuration/issues/833.
There is a workaround here: https://medium.com/@dmytrol/making-asp-net-core-user-secrets-work-in-f-projects-9b04572d81f6, in which you can set your User Secrets ID in your codebase rather than in the project file.
Upvotes: 3