Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Failed to resolve for reference Microsoft.Azure.WebJobs.Extensions - Metadata generation failed

Had to pick up a bit of work from another developer so just trying to wrap my head round it all!

But I'm having issues building an Azure Functions project and continuously getting a error coming form Microsoft.NET.Sdk.Functions.Build.targets , specifically unable to resolve a reference to Microsoft.Azure.WebJobs.Extensions.

So far I have attempted re-installing the Nuget Package, Re-Starting Visual Studio, my machine yada-yada.

I would welcome any suggestions and appreciate your time!

Full Error Below

Severity    Code    Description Project File    Line    Suppression State
Error       Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'Microsoft.Azure.WebJobs.Extensions, Version=3.0.6.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
   at Mono.Cecil.BaseAssemblyResolver.Resolve(AssemblyNameReference name, ReaderParameters parameters)
   at Mono.Cecil.BaseAssemblyResolver.Resolve(AssemblyNameReference name)
   at Mono.Cecil.DefaultAssemblyResolver.Resolve(AssemblyNameReference name)
   at Mono.Cecil.MetadataResolver.Resolve(TypeReference type)
   at Mono.Cecil.ModuleDefinition.Resolve(TypeReference type)
   at Mono.Cecil.TypeReference.Resolve()
   at MakeFunctionJson.AttributeExtensions.IsWebJobsAttribute(CustomAttribute attribute)
   at MakeFunctionJson.ParameterInfoExtensions.<>c.<IsWebJobSdkTriggerParameter>b__0_0(CustomAttribute a)
   at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source, Func`2 predicate)
   at MakeFunctionJson.ParameterInfoExtensions.IsWebJobSdkTriggerParameter(ParameterDefinition parameterInfo)
   at MakeFunctionJson.MethodInfoExtensions.<>c.<HasTriggerAttribute>b__4_0(ParameterDefinition p)
   at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source, Func`2 predicate)
   at MakeFunctionJson.MethodInfoExtensions.HasTriggerAttribute(MethodDefinition method)
   at MakeFunctionJson.MethodInfoExtensions.HasValidWebJobSdkTriggerAttribute(MethodDefinition method)
   at MakeFunctionJson.FunctionJsonConverter.GenerateFunctions(IEnumerable`1 types)+MoveNext()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at MakeFunctionJson.FunctionJsonConverter.TryGenerateFunctionJsons()
   at MakeFunctionJson.FunctionJsonConverter.TryRun()
Error generating functions metadata
    Panmure.RiskMI.DataCollector.Functions  
like image 579
benbants Avatar asked Aug 14 '20 14:08

benbants


Video Answer


2 Answers

I saw a message when running the project saying "the extensionsmetadatagenerator package was not imported correctly" Try adding the Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator nuget package to your project. It is suppose to be loaded as a dependency of Microsoft.NET.Sdk.Functions package, But I didn't see it in my project dependencies list. This worked for me.

like image 128
Clark Avatar answered Oct 20 '22 01:10

Clark


Or you can just update to

<TargetFramework>netcoreapp3.1</TargetFramework>

If you are not on 3.1

like image 6
Kicasd Avatar answered Oct 20 '22 01:10

Kicasd