gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-03 05:49:19 26 4
gpt4 key购买 nike

  • 我使用的是 WindowsAzure.Storage 9.1.1。
  • 它声明它依赖于 Newtonsoft >= 10.0.2
  • 我使用的是 .NET Framework 4.5
  • 我安装了 Newtonsoft 11.0.2
  • 当我执行以下代码时,table.ExecuteBatch 出现异常

InnerException {“无法加载文件或程序集“Newtonsoft.Json,Version=10.0.0.0,Culture=neutral,PublicKeyToken=30ad4fe6b2a6aeed”或其依赖项之一。系统无法查找指定的文件。":"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 依赖性的 Function - 它是 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 在控制台应用程序中正常工作。

您可以筹集an issue在 github 中。

关于azure - Microsoft.WindowsAzure.Storage (WindowsAzure.Storage) 9.1.1 在其依赖性之外调用 Newtonsoft 时失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49812091/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com