跳到主要內容

nuget restore failed



前言

Nuget 是 .NET 開發人員常用的套件管理工具, 透過 nuget restore 可以很便利地把Visual Studio 專案中參考到的套件抓下來


但執行的過程中若出現以下的錯誤訊息時


MSBuild auto-detection: using msbuild version '16.1.76.45076' from 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\bin'. nuget : C:\Users\andy\Documents\ava-deploy\0701\VoiceAssistant\VoiceAssistant\VoiceAssistant.csproj(328,11): error MSB4226: The imported project "C:\Pr ogram Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Microsoft\VisualStudio\v16.0\WebApplications\Microsoft.WebApplication.targets" was not found. Also, tried to find "WebApplications\Microsoft.WebApplication.targets" in the fallback search path(s) for $(VSToolsPath) - "C:\Program Files (x86)\MSBuild\Microsoft\VisualS tudio\v16.0" . These search paths are defined in "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\bin\msbuild.exe.Config". Confirm that  the path in the <Import> declaration is correct, and that the file exists on disk in one of the search paths. At line:10 char:1 + nuget restore $AppSolution + ~~~~~~~~~~~~~~~~~~~~~~~~~~     + CategoryInfo          : NotSpecified: (C:\Us


可以執行Visual Studio Installer(可以到官方網站下載)

在安裝畫面下, 把Web development build tools打勾, 然後點右下角的按鈕安裝


裝完之後nuget restore 就能夠正常使用了

留言