If I try to add a reference to a Azure Function .net462 library in my VS 2017 Resource group template, I get the following error:
===================== 28/09/2017 09:24:07 LimitedFunctionality System.AggregateException: One or more errors occurred. ---> 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.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() --- 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.<<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.<>c__DisplayClass36_1.<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.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
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.<>c__DisplayClass36_0.<b__2>d.MoveNext()<---
Was anybody able to build and deploy azure functions .net libraries from an VS Resource Group Template. I got it working with a .net462 webapp. Therefore I do not understand whats the difference here.
here is my csproj-file:
<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>