gpt4 book ai didi

c# - 为什么项目找不到 Microsoft.Azure.WebJobs 3.0.0.0

转载 作者:行者123 更新时间:2023-12-02 00:28:49 25 4
gpt4 key购买 nike

我在 Visual Studio 15.8.6 中有一个 Azure Functions (v2) 项目,其中安装了 Azure Functions 和 Web 作业工具 5.2.60618.0。我正在使用 ServiceBusTrigger。当我尝试编译该项目时,我不断收到:

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.WhereEnumerableIterator
1.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 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

虽然它提示 Microsoft.Azure.WebJobs 3.0.0.0 丢失,但它在已安装的软件包中清楚地列出了:

enter image description here

我注意到的一件事是,尽管该项目使用 .NET Standard v2.0.3,但错误消息引用了包含 netstandard1.0 的路径 (...nuget\packages\microsoft.net.sdk.functions\1.0.22\build\netstandard1.0\Microsoft.NET.Sdk.Functions.Build.targets 3) . Nuget 表示 Microsoft.NET.Sdk.Functions v1.0.22 的目标是 .NETStandard,Version=v2.0。此外,Microsoft.Azure.WebJobs 位于 netstandard2.0 文件夹中。这可能是问题所在吗?还是别的什么?

最佳答案

参见package references in v2 .

Microsoft.Azure.WebJobs.ServiceBus重命名Microsoft.Azure.WebJobs.Extensions.ServiceBusMicrosoft. Azure.WebJobs 包含在 Microsoft.NET.Sdk.Functions 中,无需单独安装。

请将 Azure Functions 和 Web 作业工具更新为 latest version (现在是 15.10.2009.0)。

使用最新的扩展和模板,当我们创建服务总线触发器时,现在默认的 nuget 依赖项是

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

关于c# - 为什么项目找不到 Microsoft.Azure.WebJobs 3.0.0.0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52708450/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com