Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nothing to do. None of the projects specified contain packages to restore

Tags:

I have a web app in dot net along with other projects. when i open the .sln file and publish the web project, it does. But, when I try to publish the web proj using command line and .csproj, it gives an error. "Nothing to do. None of the projects specified contain packages to restore."

like image 252
Suleman Mehmood Avatar asked Sep 05 '19 05:09

Suleman Mehmood


People also ask

How do I force a NuGet package to restore?

Enable package restore by choosing Tools > Options > NuGet Package Manager. Under Package Restore options, select Allow NuGet to download missing packages. In Solution Explorer, right click the solution and select Restore NuGet Packages.

Does Msbuild restore NuGet packages?

msbuild -t:Restore will restore nuget packages for projects with PackageReference nuget management format.

What does dotnet restore command do?

The dotnet restore command uses NuGet to restore dependencies as well as project-specific tools that are specified in the project file. In most cases, you don't need to explicitly use the dotnet restore command, since a NuGet restore is run implicitly if necessary when you run the following commands: dotnet new.


Video Answer


1 Answers

I got this after converting my csproj to vs2019 format and running dotnet test. The solution was to ensure i had the right test adapter and framework. My csproj files had both the old Microsoft.VisualStudio.QualityTools.UnitTestFramework reference and the new MSTest.TestAdapter + MSTest.TestFramework + Microsoft.NET.Test.Sdk. I kept the new ones and my tests were run.

like image 83
Lars Pellarin Avatar answered Sep 24 '22 12:09

Lars Pellarin