Clarification on dotnet restore in solution with mixed old/new CSPROJ schema based projects
See original GitHub issuedotnet restore
in solution directory restores the dependencies of all the “.NET Core” projects in the solution. It does not restore the non-NetCore ones in the solution (the ones which are using old CSPROJ format with packages.config to enlist their dependencies).
nuget restore
(where NUGET is v3.4, v3.5 or v4.0) in solution directory only restores the dependencies of non-NETCore projects, but does not understand the inline references in new CSPROJ schema (<PackageReference .. />
).
After some experimentations, I have figured:
- Although running both
nuget restore && dotnet restore
addresses the problem, but if we instead usenuget restore && dotnet restore --packages ./packages
, dotnet-restore clears thepackages
directory first which was populated bydotnet restore
. - Having
packages.config
for NETCore projects enlisting all the dependencies which we have in new CSPROJ (in the form of<PackageReference .. />
); enablesnuget restore
to take care of restoration singlehandedly. Tested with NuGet v3.4, v3.5 and v4.0.
Can (/will) dotnet restore
enumerate packages.configs
in the projects, so we only need to use one tool to restore the packages in mixed solution scenarios?
dotnet --info
.NET Command Line Tools (1.0.0)
Product Information:
Version: 1.0.0
Commit SHA-1 hash: e53429feb4
Runtime Environment:
OS Name: Windows
OS Version: 10.0.14393
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\1.0.0
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
dotnet restore solution is restoring projects like they are . ...
and when dotnet restore is being run from the GitHub action, I am getting the following error error MSB4057: The target "Restore" does...
Read more >dotnet restore command - .NET CLI
Learn how to restore dependencies and project-specific tools with the dotnet restore command.
Read more >Upgrading an existing .NET project files to the lean new ...
My approach is to first make a copy of the solution in Explorer, then replace the project you are upgrading with a brand...
Read more >Software Modeling Fundamentals
NET, Mono, Java and Microsoft Native (C, C++ and Visual Basic). • applications. Design and execute Test suites based on Programming by Contract...
Read more >Troubleshooting NuGet Package Restore in Visual Studio
Package Restore tries to install all package dependencies to the correct state matching the package references in your project file (.csproj) or ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@am11 you only need to run
nuget.exe restore
, it restores everythingdotnet restore
does and it also restores packages.config.https://dist.nuget.org/win-x86-commandline/v4.0.0/nuget.exe
@emgarten, you are right, Just clicked on the link and tested it worked! 😮 I thought I have nuget 4 in path (aliased nuget40), but it was actually pointing to nuget 3.5 😢
Thanks a lot! 👏