Microsoft.WindowsAzure.Storage (WindowsAzure.Storage) 9.1.1 在其依赖之外调用 Newtonsoft 失败

Microsoft.WindowsAzure.Storage (WindowsAzure.Storage) 9.1.1 failing on call to Newtonsoft outside of its dependency

InnerException {"Could not load file or assembly 'Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified.":"Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed"} System.Exception {System.IO.FileNotFoundException}

    public void TableStorageDemo()
    {
        storageAccount = CloudStorageAccount.Parse("connection");

        tableClient = storageAccount.CreateCloudTableClient();

        table = tableClient.GetTableReference("TABLE_NAME");

        TableBatchOperation batchOperation = new TableBatchOperation();

        var entity = new Entity();
        entity.Test = "Hello World";

        batchOperation.InsertOrReplace(entity);

        if (batchOperation.Count() > 0) table.ExecuteBatch(batchOperation);
    }

当它依赖于 Newtonsoft >= 10.0.2 时,为什么要寻找 10.0.0.0

我已经尝试过各种版本的 WindowsAzure.Storage 并且它仅在使用依赖于 Newtonsoft >= 6.0.8

的 8.7.0 版本时有效

我运行从 Azure 函数中获取此信息。 (我已经按照 https://github.com/Azure/azure-functions-vs-build-sdk 的建议允许 Azure Functions 运行 使用 Newtonsoft > 9.0.1 的版本)请注意,这不是抱怨 Newtonsoft 依赖的函数 - 它是 WindowsAzure.Storage. Newtonsoft 11.0.2 和 WindowsAzure.Storage 8.7.0

的函数 运行 正确

我也可以自己复制它。如果我在 Azure function App 中使用 WindowsAzure.Storage 9.1.1、Newtonsoft 11.0.2 和 Microsoft.NET.Sdk.Functions 1.0.13。

似乎与Function App SDK 依赖相关的问题。如果 WindowsAzure.Storage 8.7.0 或 7.2.1 可行,您可以使用它作为解决方法。

似乎与WindowsAzure.Storage 9.1.1本身无关的问题。 由于 WindowsAzure.Storage 9.1.1 和 Newtonsoft 11.0.2 在 console application 中正常工作。

您可以在 github 中提出 an issue