Azure Functions扩展升级后,Azure Functions项目会收到System.ValueTuples错误

时间:2018-02-27 03:26:43

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

没有代码更改或包更新,只是VS Studio 2017中Azure功能的扩展更新。我添加了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" />

1 个答案:

答案 0 :(得分:8)

  

Azure功能扩展升级后,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

之后我可以完成构建:

enter image description here

希望这有帮助。