Azure功能-无法再次导入。它已经在...(nuget,.net core 2.1)处导入-StackOverflow错误

时间:2019-03-10 11:46:24

标签: c# azure .net-core azure-functions stack-overflow

你好

我有一个.net core 2.1 Web应用程序。我向解决方案中添加了一个Azure Function应用。 我的函数应用程序引用了我的Web应用程序(因此我可以访问实体框架类)。
由于某种原因,我出现了堆栈溢出错误。

如果我不引用该Web应用程序,那么就没有问题。

如果我引用一个新的.netstandard 2类库,则没有问题。

我正在使用azure-functions-core-tools 2.4.419。

Warning 1

Severity    Code    Description Project File    Line    Suppression State
Warning MSB4011 "C:\Users\[myusername]\.nuget\packages\microsoft.azure.webjobs.script.extensionsmetadatagenerator\1.0.2\build\Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator.props" cannot be imported again. It was already imported at "C:\Code\Apps\Rubbish\WebAppWithFunctions\TestFunctionApp\obj\TestFunctionApp.csproj.nuget.g.props (17,5)". This is most likely a build authoring error. This subsequent import will be ignored. [C:\Code\Apps\Rubbish\WebAppWithFunctions\TestFunctionApp\TestFunctionApp.csproj] TestFunctionApp     38  

Warning 2

Severity    Code    Description Project File    Line    Suppression State
Warning MSB4011 "C:\Users\[username]\.nuget\packages\microsoft.azure.webjobs.script.extensionsmetadatagenerator\1.0.2\build\Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator.targets" cannot be imported again. It was already imported at "C:\Code\Apps\Rubbish\WebAppWithFunctions\TestFunctionApp\obj\TestFunctionApp.csproj.nuget.g.targets (9,5)". This is most likely a build authoring error. This subsequent import will be ignored. [C:\Code\Apps\Rubbish\WebAppWithFunctions\TestFunctionApp\TestFunctionApp.csproj]    TestFunctionApp     60  

Warning 3:
Severity    Code    Description Project File    Line    Suppression State
Warning         TestFunctionApp C:\Users\[username]\.nuget\packages\microsoft.azure.webjobs.script.extensionsmetadatagenerator\1.0.2\build\Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator.targets   20  

Warning 4:

Severity    Code    Description Project File    Line    Suppression State
Warning     Process is terminating due to StackOverflowException.   TestFunctionApp C:\Users\[username]\.nuget\packages\microsoft.azure.webjobs.script.extensionsmetadatagenerator\1.0.2\build\Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator.targets   20  

Error 1:

Severity    Code    Description Project File    Line    Suppression State
Error       Metadata generation failed. TestFunctionApp C:\Users\[username]\.nuget\packages\microsoft.azure.webjobs.script.extensionsmetadatagenerator\1.0.2\build\Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator.targets   20  

我的网络应用程序的CSProj

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>netcoreapp2.1</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.App"  />
    <PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.1.2" PrivateAssets="All" />
  </ItemGroup>

</Project>

网络应用上安装的Nuget软件包为:

Microsoft.AspNetCore.App 2.1.1
Microsoft.AspNetCore.Razor.Design 2.1.2
Microsoft.NETCore.App 2.1

预先感谢, 丹。

1 个答案:

答案 0 :(得分:0)

下面是我在机器VS 2017中尝试过的相同配置。它对我有用

enter image description here

您可以检查Azure函数中包含哪些SDK。对我来说,它正在使用Microsoft.NetCore.App 2.2.0。

这是相同的屏幕截图。

enter image description here

尝试使用Choco命令升级您的Azure功能工具

choco upgrade azure-functions-core-tools

希望有帮助。