2
votes

I have an Azure Functions (v2) project in Visual Studio 15.8.6, which has Azure Functions and Web Job Tools 5.2.60618.0 installed. I'm using a ServiceBusTrigger. When I try to compile the project, I keeping getting:

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.List1..ctor(IEnumerable1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable1 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 InSysFunctionDeviceMinuteDataProcessorV2 C:\Users\Dr Kurt Richardson.nuget\packages\microsoft.net.sdk.functions\1.0.22\build\netstandard1.0\Microsoft.NET.Sdk.Functions.Build.targets 39

Although it is complaining that Microsoft.Azure.WebJobs 3.0.0.0 is missing, it is clearly listed in the installed packages:

enter image description here

One thing I have noticed is that, although the project is using .NET Standard v2.0.3 the error message refers to a path containing netstandard1.0 (...nuget\packages\microsoft.net.sdk.functions\1.0.22\build\netstandard1.0\Microsoft.NET.Sdk.Functions.Build.targets 3) . Nuget says that v1.0.22 of Microsoft.NET.Sdk.Functions targets .NETStandard, Version=v2.0. Furthermore Microsoft.Azure.WebJobs is located in a netstandard2.0 folder. Could this be the problem? Or something else?

2
I actually had 15.9.02009.0 of Azure Functions and Web Job Tools installed - nit sure where I pulled 5.2.60618.0 from. D'oh.ProfNimrod

2 Answers

6
votes

See package references in v2.

Microsoft.Azure.WebJobs.ServiceBus has been renamed to Microsoft.Azure.WebJobs.Extensions.ServiceBus and Microsoft.Azure.WebJobs is included in Microsoft.NET.Sdk.Functions, no need to install it separately.

Please update Azure Functions and Web Job Tools to latest version(right now is 15.10.2009.0).

With latest extension and template, when we create a service bus trigger, the default nuget dependencies right now are

Microsoft.Azure.WebJobs.Extensions.ServiceBus v3.0.0
Microsoft.NET.Sdk.Functions v1.0.22
0
votes

Update Microsoft.NET.Sdk.Functions to its latest version