Q:

UserSecretsId prevents any deployment of F# ASP.NET Core app to Azure App Service

I'm trying to deploy my F# ASP.NET Core app to Azure App Service. Unfortunately, each time I try to deploy, a <UserSecretsId> element is added to my project file, which as explained in this article causes the build to fail with the following error:
A function labeled with the 'EntryPointAttribute' attribute must be the last declaration in the last file in the compilation sequence
The article explains why the error occurs and instructs to fix it by removing the element from the project file and instead adding the user secrets ID in an AssemblyInfo.fs. I have tried this and can then build manually, but each time I try to deploy, the deployment process still adds a <UserSecretsId> element with a new ID in my project file, causing the build to fail.
Is there any way I can publish an F# ASP.NET Core app to Azure App Service?
(Also reported on Microsoft/visualfsharp#5549)

A:

Add this to your .fsproj file to suppress the attribute generation.
<PropertyGroup>
 <GenerateUserSecretsAttribute>false</GenerateUserSecretsAttribute>
</PropertyGroup>

If you want to use user secrets, you will manually need to add the UserSecrets assembly attribute.
module Your.Namespace.AssemblyInfo
open Microsoft.Extensions.Configuration.UserSecrets
[<assembly: UserSecretsIdAttribute("Your UserSecretsId")>]
do()

Also, this workaround should be unnecessary in ASP.NET Core 2.2. See https://github.com/aspnet/Configuration/pull/872

