如果我尝试在VS 2017资源组模板中添加对Azure Function .net462库的引用,则会收到以下错误:
========================= 09 09:24:07 LimitedFunctionality System.AggregateException:发生了一个或多个错误。 ---> System.InvalidOperationException:无法解析mscorlib 目标框架'部署,版本= v1.0'。这可能发生在 目标框架未安装或框架名字对象是 格式不正确。在 Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkUniverse..ctor(IDesignTimeAssemblyLoader assemblyLoader,IVsDesignTimeAssemblyResolution projectAssemblyResolution,IVsSmartOpenScope dispenser)at Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkUniverse.GetUniverse(IDesignTimeAssemblyLoader assemblyLoader,IVsDesignTimeAssemblyResolution projectAssemblyResolution,IVsSmartOpenScope dispenser)at Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkProvider..ctor(IVsDesignTimeAssemblyResolution assemblyResolution,IDesignTimeAssemblyLoader assemblyLoader, TypeDescriptionProvider parentProvider,IVsSmartOpenScope openScope)
在 Microsoft.VisualStudio.ProjectUtilities.GetTargetFrameworkProvider(的IServiceProvider provider,IDesignTimeAssemblyLoader assemblyLoader,IVsHierarchy 层次结构,对象实例)at Microsoft.VisualStudio.Design.VSTypeResolutionService.get_TypeProvider() 在 Microsoft.VisualStudio.Design.VSTypeResolutionService.VSLangProj._dispReferencesEvents.ReferenceAdded(参考 r)at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.Automation.OAVSReferences.OnReferenceAdded(参考 参考)at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.ReferencesHostBridge.ApplyAsync(ReferencesDelta 价值) Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.ProjectHostBridge3.<>c__DisplayClass36_1.<<InitializeCoreAsync>b__3>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.Threading.JoinableTask.<JoinAsync>d__78.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.Threading.JoinableTask
1.d__3.MoveNext() ---从抛出异常的先前位置开始的堆栈跟踪结束--- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务 任务) System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务 任务) Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.ProjectHostBridge3.<>c__DisplayClass36_0.<<InitializeCoreAsync>b__2>d.MoveNext() --- End of inner exception stack trace --- ---> (Inner Exception #0) System.InvalidOperationException: Could not resolve mscorlib for target framework 'Deployment,Version=v1.0'. This can happen if the target framework is not installed or if the framework moniker is incorrectly formatted. at Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkUniverse..ctor(IDesignTimeAssemblyLoader assemblyLoader, IVsDesignTimeAssemblyResolution projectAssemblyResolution, IVsSmartOpenScope dispenser) at Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkUniverse.GetUniverse(IDesignTimeAssemblyLoader assemblyLoader, IVsDesignTimeAssemblyResolution projectAssemblyResolution, IVsSmartOpenScope dispenser) at Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkProvider..ctor(IVsDesignTimeAssemblyResolution assemblyResolution, IDesignTimeAssemblyLoader assemblyLoader, TypeDescriptionProvider parentProvider, IVsSmartOpenScope openScope)
3.&LT;&GT; c__DisplayClass36_1&LT; b__3&GT; d.MoveNext() ---从抛出异常的先前位置开始的堆栈跟踪结束--- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务 任务) System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务 任务) Microsoft.VisualStudio.Threading.JoinableTask.d__78.MoveNext() ---从抛出异常的先前位置开始的堆栈跟踪结束--- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务 任务) System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务 任务) Microsoft.VisualStudio.Threading.JoinableTask
at Microsoft.VisualStudio.ProjectUtilities.GetTargetFrameworkProvider(IServiceProvider provider, IDesignTimeAssemblyLoader assemblyLoader, IVsHierarchy hierarchy, Object instance) at Microsoft.VisualStudio.Design.VSTypeResolutionService.get_TypeProvider() at Microsoft.VisualStudio.Design.VSTypeResolutionService.VSLangProj._dispReferencesEvents.ReferenceAdded(Reference r) at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.Automation.OAVSReferences.OnReferenceAdded(Reference reference) at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.ReferencesHostBridge.ApplyAsync(ReferencesDelta value) at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.ProjectHostBridge1.<JoinAsync>d__3.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.ProjectHostBridge
3.&LT;&GT; c__DisplayClass36_0&LT; b__2&GT; d.MoveNext()&LT; ---
是否有人能够从VS资源组模板构建和部署azure函数.net库。 我使用.net462 webapp。因此,我不明白这里有什么不同。
这是我的csproj文件:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net461</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Azure.NotificationHubs" Version="1.0.9" />
<PackageReference Include="Microsoft.Azure.WebJobs.ServiceBus" Version="2.1.0-beta1" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="1.0.2" />
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
<PackageReference Include="StackExchange.Redis" Version="1.2.6" />
</ItemGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Configuration" />
</ItemGroup>
<ItemGroup>
<None Update="host.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="local.settings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>