1
votes

I want my project to have the following packages

  • Microsoft.Azure.ServiceBus
  • Microsoft.Azure.WebJobs.Extensions
  • Microsoft.Azure.WebJobs.Extensions.Storage
  • Microsoft.Azure.WebJobs.ServiceBus
  • Microsoft.NET.Sdk.Functions
  • .NETStandard Library
  • Newtonsoft.Json

Right now I have the most recent versions

  • Microsoft.Azure.ServiceBus (3.1.1)
  • Microsoft.Azure.WebJobs.Extensions (3.0.0)
  • Microsoft.Azure.WebJobs.Extensions.Storage (3.0.0)
  • Microsoft.Azure.WebJobs.ServiceBus (v3.0.0-beta8)
  • Microsoft.NET.Sdk.Functions (1.0.22)
  • .NETStandard Library (2.0.1)
  • Newtonsoft.Json(11.0.2)

Which have the following dependencies of WebJobs:

  • Microsoft.Azure.ServiceBus [None]
  • Microsoft.Azure.WebJobs.Extensions [Microsoft.Azure.WebJobs (>= 3.0.0)]
  • Microsoft.Azure.WebJobs.Extensions.Storage [Microsoft.Azure.WebJobs (>= 3.0.0)]
  • Microsoft.Azure.WebJobs.ServiceBus [Microsoft.Azure.WebJobs (= 2.2.0)]
  • Microsoft.NET.Sdk.Functions [Microsoft.Azure.WebJobs (>= 3.0.0 && < 3.1.0)]
  • .NETStandard Library [None]
  • Newtonsoft.Json [None]

Interestingly, Visual Studio isn't flagging this as a problem (no yellow triangles in Solution Explorer), even though there are clearly conflicting version requirements. When I try to build my Function App project I get the error

Severity Code Description Project File Line Suppression State Error System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Azure.WebJobs, Version=3.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified. File name: 'Microsoft.Azure.WebJobs, Version=3.0.0.0, Culture=neutral, PublicKeyToken=null' at System.ModuleHandle.ResolveType(RuntimeModule module, Int32 typeToken, IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs, Int32 methodInstCount, ObjectHandleOnStack type) at System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule module, Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext) at System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments) at System.Reflection.CustomAttribute.FilterCustomAttributeRecord(CustomAttributeRecord caRecord, MetadataImport scope, Assembly& lastAptcaOkAssembly, RuntimeModule decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, Object[] attributes, IList derivedAttributes, RuntimeType& attributeType, IRuntimeMethodInfo& ctor, Boolean& ctorHasParameters, Boolean& isVarArg) at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent) at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeParameterInfo parameter, RuntimeType caType) at System.Attribute.InternalParamGetCustomAttributes(ParameterInfo param, Type type, Boolean inherit) at MakeFunctionJson.ParameterInfoExtensions.GetDisabledAttribute(ParameterInfo parameterInfo) at System.Linq.Enumerable.WhereSelectArrayIterator2.MoveNext() at System.Linq.Enumerable.WhereEnumerableIterator1.MoveNext() at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable1 source)
at MakeFunctionJson.MethodInfoExtensions.GetDisabled(MethodInfo method) at MakeFunctionJson.MethodInfoExtensions.HasUnsuportedAttributes(MethodInfo method, String& error) at MakeFunctionJson.FunctionJsonConverter.<GenerateFunctions>d__9.MoveNext() at System.Collections.Generic.List
1..ctor(IEnumerable1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable
1 source) 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

Any way out of this Nuget Hell or can I not use all these packages? I've tried looking at previous versions and there seems to be no way to get them all to agree on a version of WebJobs. How does one typically resolve these situations?

1

1 Answers

1
votes

Remove Microsoft.Azure.WebJobs.ServiceBus, the new package is now called Microsoft.Azure.WebJobs.Extensions.ServiceBus(3.0.0). See package references in v2 functions.

Besides, Microsoft.NET.Sdk.Functions(1.0.22) contains Newtonsoft.Json(11.0.2) and Microsoft.Azure.WebJobs.Extensions (3.0.0), no need to install them separately. And Microsoft.Azure.WebJobs.Extensions.ServiceBus(3.0.0) contains Microsoft.Azure.ServiceBus(3.0.2) as well, you don't need to install it either as long as the latest version is not necessary.

For example, you can create a v2 servicebus trigger template in VS and only need to add Microsoft.Azure.WebJobs.Extensions.Storage (3.0.0) to achieve your goal.