1
votes

I'm trying to build an Azure Function project. But after I create it from VS 2017 (File -> New project, without making any other changes) it fails to restore NuGet packages. Errors I'm getting

Package Microsoft.Tpl.Dataflow 4.5.24 does not support any target frameworks.

Package Microsoft.Azure.KeyVault.Core 1.0.0 does not support any target frameworks.

I'm using

  • Visual Studio 2017 Community v15.5.7. Workloads installed:
    • ASP.NET and web development
    • Azure development
    • .NET Core cross-platform development
  • Azure Functions and Web Tools Extension v15.0.40108.0 (have tried also with the version shipped with VS)

Have tried on two other PCs with the same workloads installed and it works.

Have uninstalled/reinstalled VS 2017 and .NET framework but no luck.

Any help appreciated.

1
You're targeting .NET Core. Switch the function runtime to beta in the portal.evilSnobu
@evilSnobu I don't use the Azure portal at all, just creating a project in VS in .NET Framework 4.6.1 and using v1 of Azure Functions. take.ms/lbJNdSzilardD
@evilSnobu just created a function from the portal with beta runtime (version: 2.0.11415.0) and downloaded the project. When opening in VS I'm getting the same errorsSzilardD

1 Answers

2
votes

Fixed by clearing NuGet cache and changing package format to 'PackageReference'

VS 2017 -> Tools -> Options -> NuGet Package Manager

  • Changed 'Default package management format' from 'Packages.config' to 'PackageReference'
  • Checked 'Allow format selection on first package install'
  • Actioned 'Clear All NuGet Cache(s)'