简体   繁体   中英

NuGet Package Manager - Project 'Default' is not found. - Visual Studio 2017

I am using Visual Studio 2017 Community and I am trying to build a solution for a project I just started working on.

Whenever I try to build the solution file, I get these errors:

C:\Projects\UnitTests\UnitTests.csproj(91,5): error : This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is ..\packages\MSTest.TestAdapter.1.1.18\build\net45\MSTest.TestAdapter.props.
C:\Projects\WebAPI\WebAPI.csproj(469,5): error : This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is ..\packages\Microsoft.Net.Compilers.2.1.0\build\Microsoft.Net.Compilers.props.
C:\Projects\APITester\APITester.csproj(316,5): error : This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is ..\packages\Microsoft.Net.Compilers.2.6.1\build\Microsoft.Net.Compilers.props.
C:\Projects\Admin\Admin.csproj(391,5): error : This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is ..\packages\Microsoft.Net.Compilers.2.6.1\build\Microsoft.Net.Compilers.props.

If I try to run

Update-Package --reinstall

or

Install-Package Microsoft.Net.Compilers -Version 2.6.1

I get the following errors:

Install-Package : Project 'Default' is not found.
At line:1 char:1
+ Install-Package Microsoft.Net.Compilers -Version 2.6.1
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Default:String) [Install-Package], ItemNotFoundException
    + FullyQualifiedErrorId : NuGetProjectNotFound,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand


Update-Package : Project 'Default' is not found.
At line:1 char:1
+ Update-Package --reinstall
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Default:String) [Update-Package], ItemNotFoundException
    + FullyQualifiedErrorId : NuGetProjectNotFound,NuGet.PackageManagement.PowerShellCmdlets.UpdatePackageCommand

Open the solution for those projects as that will automatically set the default project. Then you will be able to install those nuget packages.

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