【问题标题】:Azure Functions project gets System.ValueTuples error after Azure Functions extension upgradeAzure Functions 扩展升级后 Azure Functions 项目出现 System.ValueTuples 错误
【发布时间】:2018-02-28 14:48:21
【问题描述】:

没有代码更改或包更新,只是 VS Studio 2017 中 Azure Functions 的扩展更新。我添加了 Nuget 包,将其删除,尝试绑定重定向。似乎没有任何效果。

Severity    Code    Description Project File    Line    Suppression State
Error       System.IO.FileNotFoundException: Could not load file or assembly 'System.ValueTuple, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.
File name: 'System.ValueTuple, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
   at MakeFunctionJson.FunctionJsonConverter.TryGenerateFunctionJsons()
   at MakeFunctionJson.FunctionJsonConverter.TryRun()

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

Error generating functions metadata
    Functions   C:\Users\aiueru7\.nuget\packages\microsoft.net.sdk.functions\1.0.8\build\netstandard1.0\Microsoft.NET.Sdk.Functions.Build.targets   39  

我能够使用这些 Nuget 依赖项创建一个全新的空白 Function App csproj 并重现错误

<PackageReference Include="AWSSDK.S3" Version="3.3.11.4" />
<PackageReference Include="CqrsLite" Version="0.18.1" />
<PackageReference Include="Microsoft.Azure.DocumentDB" Version="1.20.2" />
<PackageReference Include="Microsoft.Azure.Management.CosmosDB.Fluent" Version="1.6.0" />
<PackageReference Include="Microsoft.Azure.WebJobs" Version="2.1.0" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.DocumentDB" Version="1.1.0" />
<PackageReference Include="Microsoft.Azure.WebJobs.ServiceBus" Version="2.1.0" />
<PackageReference Include="Microsoft.CrmSdk.XrmTooling.CoreAssembly" Version="8.2.0.5" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="1.0.6" />
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" />
<PackageReference Include="SimpleInjector" Version="4.0.12" />
<PackageReference Include="System.ValueTuple" Version="4.4.0" />

【问题讨论】:

  • 您是否尝试删除文件夹“C:\Users\name.nuget\packages\microsoft.net.sdk.functions\1.0.8\build\netstandard1.0”? github.com/Azure/azure-functions-host/issues/1927
  • 我删除了,但没有改变。
  • 同样的问题,在我更新的现有项目上

标签: asp.net visual-studio-2017 nuget


【解决方案1】:

Azure Functions 扩展升级后 Azure Functions 项目出现 System.ValueTuples 错误

我可以使用版本 1.0.8 的 nuget 包 Microsoft.NET.Sdk.Functions 重现此问题。

升级 Azure Functions 扩展后,在 Visual Studio 2017 中创建 Azure Functions 项目,然后将 nuget 包更新为Azure Functions SDK 1.0.8,构建项目,得到与您相同的错误(无需添加任何其他 nuget 包)。但是,如果我将该 nuget 包降级到 1.0.6 版本,则该项目可以正常工作,因此此问题应该与包 Microsoft.NET.Sdk.Functions 1.0.8 的最新版本更相关。在 Github 上查看same issue

为了解决这个问题,我删除了 netstandard1.0 文件夹:

"C:\Users\name.nuget\packages\microsoft.net.sdk.functions\1.0.8\build\netstandard1.0

但我注意到你的项目文件中的版本仍然是1.0.6

<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="1.0.6" />

所以请将该包更新到1.0.8,然后删除nuget包microsoft.net.sdk.functions中的文件夹netstandard1.0

之后我就可以完成构建了:

希望这会有所帮助。

【讨论】:

  • 删除 netstandard1.0 文件夹就可以了。谢谢!
  • 我在使用 Azure Functions V2 (.NET Standard 2.0) 时遇到了这个问题,并按照您的建议删除了 netstandard1.0 文件夹。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-08-25
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-12-20
相关资源
最近更新 更多