【问题标题】:UserSecretsId prevents any deployment of F# ASP.NET Core app to Azure App ServiceUserSecretsId 阻止将 F# ASP.NET Core 应用程序部署到 Azure 应用程序服务
【发布时间】:2018-08-31 07:15:12
【问题描述】:

我正在尝试将我的 F# ASP.NET Core 应用程序部署到 Azure 应用程序服务。不幸的是,每次我尝试部署时,我的项目文件中都会添加一个 <UserSecretsId> 元素,正如 in this article 所解释的那样,这会导致构建失败并出现以下错误:

A function labeled with the 'EntryPointAttribute' attribute must be the last declaration in the last file in the compilation sequence

文章解释了错误发生的原因,并指示通过从项目文件中删除元素并在 AssemblyInfo.fs 中添加用户机密 ID 来修复它。我已经尝试过了,然后可以手动构建,但是每次我尝试部署时,部署过程仍然会在我的项目文件中添加一个带有新 ID 的 <UserSecretsId> 元素,导致构建失败。

有什么方法可以将 F# ASP.NET Core 应用发布到 Azure 应用服务?

(也在Microsoft/visualfsharp#5549上报道)

【问题讨论】:

  • 用错误消息和更多内容更新了问题。

标签: azure f# azure-web-app-service


【解决方案1】:

将此添加到您的 .fsproj 文件以禁止生成属性。

<PropertyGroup>
 <GenerateUserSecretsAttribute>false</GenerateUserSecretsAttribute>
</PropertyGroup>

如果要使用用户机密,则需要手动添加 UserSecrets 程序集属性。

module Your.Namespace.AssemblyInfo
open Microsoft.Extensions.Configuration.UserSecrets
[<assembly: UserSecretsIdAttribute("Your UserSecretsId")>]
do()

此外,在 ASP.NET Core 2.2 中应该不需要此解决方法。见https://github.com/aspnet/Configuration/pull/872

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-07-25
    • 2023-03-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-07-25
    • 1970-01-01
    相关资源
    最近更新 更多