0

如果我尝试在我的 VS 2017 资源组模板中添加对 Azure Function .net462 库的引用,则会收到以下错误:

===================== 28/09/2017 09:24:07 LimitedFunctionality System.AggregateException:发生一个或多个错误。---> System.InvalidOperationException:无法解析目标框架“部署,版本=v1.0”的 mscorlib。如果未安装目标框架或框架名字对象的格式不正确,则可能会发生这种情况。在 Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkUniverse.GetUniverse(IDesignTimeAssemblyLoader assemblyLoader, IVsDesignTimeAssemblyResolution projectAssemblyResolution, IVsSmartOpenScope 分配器) 在 Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkUniverse..ctor(IDesignTimeAssemblyLoader assemblyLoader, IVsDesignTimeAssemblyResolution projectAssemblyResolution, IVsSmartOpenScope 分配器) Shell.Design.VsTargetFrameworkProvider。
在 Microsoft.VisualStudio.ProjectUtilities.GetTargetFrameworkProvider(IServiceProvider 提供程序,IDesignTimeAssemblyLoader 程序集加载器,IVsHierarchy 层次结构,对象实例)在 Microsoft.VisualStudio.Design.VSTypeResolutionService.get_TypeProvider() 在 Microsoft.VisualStudio.Design.VSTypeResolutionService.VSLangProj._dispReferencesEvents.ReferenceAdded(参考 r ) 在 Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.ReferencesHostBridge.ApplyAsync(ReferencesDelta 值) 在 Microsoft.VisualStudio.ProjectSystem 的 Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.Automation.OAVSReferences.OnReferenceAdded(参考参考)。 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.JoinableTask1.d__3.MoveNext() --- 从先前引发异常的位置结束堆栈跟踪---在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) 在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task任务)在 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)
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.ProjectHostBridge
3.<>c__DisplayClass36_1.<b__3>d.MoveNext() --- 从先前引发异常的位置结束堆栈跟踪 --- 在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) 在 System.Runtime。 Microsoft.VisualStudio.Threading.JoinableTask.d__78.MoveNext() 处的 CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) --- 从先前引发异常的位置结束堆栈跟踪 --- 在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (任务任务)在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)在 Microsoft.VisualStudio.Threading.JoinableTask 1.<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.ProjectHostBridge3.<>c__DisplayClass36_0.<b__2>d.MoveNext()<---

是否有人能够从 VS 资源组模板构建和部署 azure functions .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>
4

0 回答 0