.net core System.Runtime 4.2.1.0 building v2 Azure Functions项目的FileNotFoundException
我尝试构建Azure Functions v2项目时出错。奇怪的是,这种情况并不总是发生。我尝试了Visual Studio 2017(15.9.3)和Visual Studio 2019(预览版1.1)的各种组合,以及在托管的2017代理上构建Azure DevOps,同时在1.0.22、1.0.23和1.0.24之间更改SDK的功能.net core System.Runtime 4.2.1.0 building v2 Azure Functions项目的FileNotFoundException,.net-core,azure-functions,.net Core,Azure Functions,我尝试构建Azure Functions v2项目时出错。奇怪的是,这种情况并不总是发生。我尝试了Visual Studio 2017(15.9.3)和Visual Studio 2019(预览版1.1)的各种组合,以及在托管的2017代理上构建Azure DevOps,同时在1.0.22、1.0.23和1.0.24之间更改SDK的功能 在版本为1.0.24的Azure DevOps上,它总是会因此错误而失败 它总是在VS2019版本1.0.24中成功 与2017年和2019年相比,v1.0.
- 在版本为1.0.24的Azure DevOps上,它总是会因此错误而失败
- 它总是在VS2019版本1.0.24中成功
- 与2017年和2019年相比,v1.0.22总是失败
- 其他的组合无论失败与否都是命中或未命中的
System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime, Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
File name: 'System.Runtime, Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
at System.Reflection.RuntimeAssembly.GetExportedTypes(RuntimeAssembly assembly, ObjectHandleOnStack retTypes)
at System.Reflection.RuntimeAssembly.GetExportedTypes()
at MakeFunctionJson.FunctionJsonConverter.TryGenerateFunctionJsons()
at MakeFunctionJson.FunctionJsonConverter.TryRun()
Error generating functions metadata
FunctionsCore C:\Users\myusername\.nuget\packages\microsoft.net.sdk.functions\1.0.24\build\netstandard1.0\Microsoft.NET.Sdk.Functions.Build.targets 39
这是我的.csproj文件:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<AzureFunctionsVersion>v2</AzureFunctionsVersion>
<AssemblyName>MyProject.FunctionsCore</AssemblyName>
<RootNamespace>MyProject.FunctionsCore</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.CosmosDB" Version="3.0.2" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="1.0.24" />
</ItemGroup>
<ItemGroup>
<None Update="host.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="local.settings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
</None>
</ItemGroup>
</Project>
我解决了相同的错误,但在中(它发生在VisualStudio中生成T4模板时) 尝试将此bindingRedirect放入
C:\Users\\AppData\Local\Microsoft\VisualStudio\15.0\u 29f8d23a\devenv.exe.config中->所有其他bindingRedirect的位置在哪里
在MSDN论坛[1]中通过同样的方法解决这个问题:我在这里创建了一个关于同一问题的问题:自从你发布了你的问题后,你找到解决方案了吗?奇怪的是,你的答案还没有人喜欢。在组合.Net Framework和.Net核心3.0项目时,您也会遇到此问题
=== Pre-bind state information ===
LOG: DisplayName = System.Runtime, Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
(Fully-specified)
LOG: Appbase = file:///C:/Users/myusername/.nuget/packages/microsoft.net.sdk.functions/1.0.24/tools/net46/
LOG: Initial PrivatePath = NULL
Calling assembly : Cacs.MyProject.FunctionsCore, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in LoadFrom load context.
WRN: Native image will not be probed in LoadFrom context. Native image will only be probed in default load context, like with Assembly.Load().
LOG: No application configuration file found.
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Post-policy reference: System.Runtime, Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
LOG: Attempting download of new URL file:///C:/Users/myusername/.nuget/packages/microsoft.net.sdk.functions/1.0.24/tools/net46/System.Runtime.DLL.
LOG: Attempting download of new URL file:///C:/Users/myusername/.nuget/packages/microsoft.net.sdk.functions/1.0.24/tools/net46/System.Runtime/System.Runtime.DLL.
LOG: Attempting download of new URL file:///C:/Users/myusername/.nuget/packages/microsoft.net.sdk.functions/1.0.24/tools/net46/System.Runtime.EXE.
LOG: Attempting download of new URL file:///C:/Users/myusername/.nuget/packages/microsoft.net.sdk.functions/1.0.24/tools/net46/System.Runtime/System.Runtime.EXE.
LOG: Attempting download of new URL file:///C:/Users/myusername/source/repos/MyProject/MyProject/FunctionsCore/bin/Debug/netcoreapp2.1/bin/System.Runtime.DLL.
LOG: Attempting download of new URL file:///C:/Users/myusername/source/repos/MyProject/MyProject/FunctionsCore/bin/Debug/netcoreapp2.1/bin/System.Runtime/System.Runtime.DLL.
LOG: Attempting download of new URL file:///C:/Users/myusername/source/repos/MyProject/MyProject/FunctionsCore/bin/Debug/netcoreapp2.1/bin/System.Runtime.EXE.
LOG: Attempting download of new URL file:///C:/Users/myusername/source/repos/MyProject/MyProject/FunctionsCore/bin/Debug/netcoreapp2.1/bin/System.Runtime/System.Runtime.EXE.