Suleman Mehmood
Suleman Mehmood

Reputation: 401

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

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."

Upvotes: 24

Views: 12429

Answers (2)

Graham Asher
Graham Asher

Reputation: 1780

I had this problem in a batch file I use to build a UWP component for release. The build command is

%MSBUILD% CartoType\src\main\single_library\uwp\CartoType\CartoType.sln -p:Configuration=Release;Platform=x64

where %MSBUILD% is the full path to msbuild. I first added an msbuild command with the -t:restore option and got the message reported by the original poster ('Nothing to do. None of the projects specified contain packages to restore').

The solution was to add this command before the command given above:

%MSBUILD% CartoType\src\main\single_library\uwp\CartoType\CartoType.sln -p:RestorePackagesConfig=true -t:restore

Upvotes: 4

Lars Pellarin
Lars Pellarin

Reputation: 746

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.

Upvotes: 2

Related Questions