Azure Functions: [null] Metadata generation failed (Rider 2018.3.4) - Resolved

dotnet core 2.1 project with Azure Functions is failing with the errors below.

This seems to be a Rider config issue on this machine because:

  1. This project builds in Rider on another machine with the exact same version of Rider, core and SDKs
  2. On the failing machine, a "dotnet build" completes with no errors

 

Errors are:

 Microsoft.NET.Sdk.Functions.Build.targets(41, 5): [null] Metadata generation failed.

Microsoft.NET.Sdk.Functions.Build.targets(41, 5): [null] 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()

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

 

 

2 comments
Comment actions Permalink

This is the output from `dotnet build` on the same machine

As you can see, this succeeds and the functions can be deployed to Azure.

 

C:\temp\xxxprojectxxx.tmp\xxxprojectxxx>dotnet build
Microsoft (R) Build Engine version 15.9.20+g88f5fadfbe for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

Restore completed in 42.64 ms for C:\temp\xxxprojectxxx.tmp\xxxprojectxxx\Models\Models.csproj.
Restore completed in 126.87 ms for C:\temp\xxxprojectxxx.tmp\xxxprojectxxx\AzureFunctions\AzureFunctions.csproj.
Restore completed in 126.9 ms for C:\temp\xxxprojectxxx.tmp\xxxprojectxxx\AmazonServices\AmazonServices.csproj.
Restore completed in 126.91 ms for C:\temp\xxxprojectxxx.tmp\xxxprojectxxx\BusinessLogic\BusinessLogic.csproj.
Restoring packages for C:\temp\xxxprojectxxx.tmp\xxxprojectxxx\TesterApp\TesterApp.csproj...
Restore completed in 90.33 ms for C:\temp\xxxprojectxxx.tmp\xxxprojectxxx\Storage\Storage.csproj.
Restore completed in 37.65 ms for C:\temp\xxxprojectxxx.tmp\xxxprojectxxx\Utilities\Utilities.csproj.
Restore completed in 39.68 ms for C:\temp\xxxprojectxxx.tmp\xxxprojectxxx\UnitTests\UnitTests.csproj.
Generating MSBuild file C:\temp\xxxprojectxxx.tmp\xxxprojectxxx\TesterApp\obj\TesterApp.csproj.nuget.g.props.
Restore completed in 1.26 sec for C:\temp\xxxprojectxxx.tmp\xxxprojectxxx\TesterApp\TesterApp.csproj.
Models -> C:\temp\xxxprojectxxx.tmp\xxxprojectxxx\Models\bin\Debug\netcoreapp2.1\Models.dll
Utilities -> C:\temp\xxxprojectxxx.tmp\xxxprojectxxx\Utilities\bin\Debug\netcoreapp2.1\Utilities.dll
AmazonServices -> C:\temp\xxxprojectxxx.tmp\xxxprojectxxx\AmazonServices\bin\Debug\netcoreapp2.1\AmazonServices.dll
Storage -> C:\temp\xxxprojectxxx.tmp\xxxprojectxxx\Storage\bin\Debug\netcoreapp2.1\Storage.dll
BusinessLogic -> C:\temp\xxxprojectxxx.tmp\xxxprojectxxx\BusinessLogic\bin\Debug\netcoreapp2.1\BusinessLogic.dll
AzureFunctions -> C:\temp\xxxprojectxxx.tmp\xxxprojectxxx\AzureFunctions\bin\Debug\netcoreapp2.1\bin\AzureFunctions.dll
StorageTests\Entities\UnregisteredUserEntityTests.cs(66,13): warning xUnit2010: Do not use Assert.True() to check for string equality. [C:\temp\xxxprojectxxx.tmp\xxxprojectxxx\UnitTests\UnitTests.csproj]
StorageTests\Entities\UnregisteredUserEntityTests.cs(82,13): warning xUnit2010: Do not use Assert.True() to check for string equality. [C:\temp\xxxprojectxxx.tmp\xxxprojectxxx\UnitTests\UnitTests.csproj]
StorageTests\Entities\UnregisteredUserEntityTests.cs(50,13): warning xUnit2010: Do not use Assert.True() to check for string equality. [C:\temp\xxxprojectxxx.tmp\xxxprojectxxx\UnitTests\UnitTests.csproj]
TesterApp -> C:\temp\xxxprojectxxx.tmp\xxxprojectxxx\TesterApp\bin\Debug\netcoreapp2.1\TesterApp.dll
UnitTests -> C:\temp\xxxprojectxxx.tmp\xxxprojectxxx\UnitTests\bin\Debug\netcoreapp2.1\UnitTests.dll

Build succeeded.


0
Comment actions Permalink

Huh... false alarm, of a kind...

 

Re this link, I added the following to the functions .csproj file:

<UseNETCoreGenerator>true</UseNETCoreGenerator>

 

So, that's great, but it still doesn't explain why the project built on Rider on another machine and could also be built on this machine from the command line.

Any thoughts, anyone?

0

Please sign in to leave a comment.