f# - 引用外部程序集失败

标签 f# azure-functions

我无法引用私有(private)程序集。我已经按照文档进行操作,但它仍然失败并显示错误消息:

2016-09-29T19:43:08.615 startup(2,1): error FS82: Could not resolve this reference. Could not locate the assembly "Backend.dll". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. (Code=MSB3245)

这是 run.fsx 文件:

#r "Backend.dll"

open System
open System.IO
open System.Net
open System.Net.Http.Headers
open System.Collections.Generic
open CoP

let createResponse json =
    let responseJson = Request.handleJson json
    let response = new HttpResponseMessage()
    response.Content <- new StringContent(responseJson)
    response.StatusCode <- HttpStatusCode.OK
    response.Content.Headers.ContentType <- MediaTypeHeaderValue("application/json")
    response

let Run (req: HttpRequestMessage) =
    async {
        let! json = req.Content.ReadAsStringAsync()
        return createResponse json
    } |> Async.StartAsTask

我还将 Backend.dll 放在函数所在文件夹内的 bin 文件夹中。

azure function folder structure

我错过了什么?

最佳答案

您似乎在 Azure Functions F# 实现中遇到了私有(private)程序集解析错误。 我已打开此问题进行跟踪,并将在下一个版本中包含一个修复程序: https://github.com/Azure/azure-webjobs-sdk-script/issues/733

与此同时,您应该能够使用以下方式引用您的私有(private)程序集:

#r "bin/Backend.dll"

希望这对您有所帮助!

关于f# - 引用外部程序集失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39778875/

相关文章:

.net - 为什么 F# 中 bigint 缺少按位非运算符 (~~~)?

F# 类型和函数签名

azure - 如何在不使用 Visual Code Studio 的情况下使用 Python 创建 Azure 函数应用程序

Azure Function Blob 触发器 CloudBlockBlob 绑定(bind)

azure - Visual Studio 部署队列触发器 Azure Functions

f# - 点自由函数/闭包和泛型类型之间的困境?

.net - F# 未使用的保留关键字何时从规范中删除?

azure - 如何在Azure Durable Function编排实例之间缓存数据?

Azure函数: Could not load file or assembly Microsoft. IdentityModel.Tokens,版本=5.2.1.0

asp.net-core - 如何在 Fable Elmish SPA 中处理从后端重定向到身份验证提供程序