azure - 仅当从 GitHub 部署时,Azure 中的 F# 编译错误

标签 azure f# kudu

我正在将 C# 网站从 GitHub 存储库部署到 Azure。该网站引用了几个 F# 库,它们在我的计算机上编译得很好,但在 Azure 中,构建失败并出现许多编译错误。

这是构建日志的片段:

FS0001: A generic construct requires that the type 'Company' have a public default constructor [C:\DWASFiles\Sites\eureka-servicestack-poc\VirtualDirectory0\site\repository\Eureka.ServiceStack.FSharp.Poc\Services\Services.fsproj]
C:\DWASFiles\Sites\eureka-servicestack-poc\VirtualDirectory0\site\repository\Eureka.ServiceStack.FSharp.Poc\Services\CompaniesService.fs(28,17): error FS0039: The field, constructor or member 'PopulateWith' is not defined [C:\DWASFiles\Sites\eureka-servicestack-poc\VirtualDirectory0\site\repository\Eureka.ServiceStack.FSharp.Poc\Services\Services.fsproj]
C:\DWASFiles\Sites\eureka-servicestack-poc\VirtualDirectory0\site\repository\Eureka.ServiceStack.FSharp.Poc\Services\AppHost.fs(17,55): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [C:\DWASFiles\Sites\eureka-servicestack-poc\VirtualDirectory0\site\repository\Eureka.ServiceStack.FSharp.Poc\Services\Services.fsproj]
An error has occurred during web site deployment.

在我将 CLIMutable 属性放在有问题的记录类型上后,第一个错误应该已修复,第二个错误应在包含正确的命名空间后已修复。我不知道第三个错误到底是什么,特别是因为它们都不是在本地发生的。

为了确保两个地方都有相同版本的 F#,我在解决方案中包含了 FSharp.Core dll 并引用本地版本。这没有帮助,但它删除了无法找到该文件版本 4.3.1 的警告。

我是否可能正在运行另一个版本的 F# 编译器?如何检查?到目前为止它运行良好,这让我怀疑某些东西的版本控制存在细微的差异。不幸的是,似乎很难深入了解构建环境中实际发生的情况。这是一个免费的 Azure 网站,您似乎无法直接访问它。

我现在可能可以解决个别问题,但这里似乎有一个更深层次的问题。

最佳答案

事实证明,这是使用不同版本的 F# 编译器时出现的问题。使用Visual Studio 2013 RC,我使用的是3.1版本,其中有一些improvements导致我的具体问题没有出现。

这个问题很难识别,因为将我的 F# 项目更改为使用 Visual Studio 中的 3.0 编译器没有任何效果(它仍然编译得很好)。我什至在 Visual Studio 2012 中打开了该解决方案,并且一切都编译得很好。直到我在 VS 2012 中从头开始创建一个新项目时,我才开始出现与服务器上相同的编译错误。所以我猜想这一定是创建的项目文件中的一个错误(或者至少不是非常理想的功能)。我不确定这是否应该被归类为 VS 2013 的错误,特别是因为我不知道到底是什么导致了错误。

因此,在 Azure(或者这是 Kudu 的东西?)支持 3.1 编译器之前,简单的解决方案是在 VS 2012 中重新创建项目文件,或者将无法编译的代码复制到可以测试修复的测试解决方案.

关于azure - 仅当从 GitHub 部署时,Azure 中的 F# 编译错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18947202/

相关文章:

entity-framework - 如何使用 Azure 存储和 Entity Framework 上传文件

c# - MonoDevelop 的 System.TypeLoadException

interface - F# 中的对象表达式和捕获的状态

azure - 如何使用 Kudu 控制台删除 Azure 应用服务文件夹中的所有文件

azure - 与 Azure Function 一起使用的存储帐户上的文件 IO 事件较高

java - 如何通过java服务将文件从一个目录复制到azure中的另一个目录?

entity-framework - 自创建数据库以来,支持 'myDBContext' 上下文的模型已发生更改。考虑使用 Code First 迁移来更新数据库

azure - 通过 Powershell 从 KUDU(Azure Web 应用程序)下载文件

c# - 在不同的 Azure 服务总线队列中使用相同的消息 ID 会导致错误

dictionary - 在 F# 中多次更新 map