简体   繁体   中英

NuGet package restore fails for Azure Function project using Visual Studio 2017

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.

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)'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM