how to copy NuGet packages from one project to another

You probably faced that problem at least once, here you are working on your modules trying to build a new model for your solution, create a new dll project and ...
here it comes, NuGet packages, you need to have manually install all these NuGet packages that you know form the base of needed libraries for your new module or plug-in, and you need to get every package plus the versions right.

If you are like me this would be a soul crushing task to do, so in order for me to be more "efficient" i searched for a way to copy that to the new project, at first i thought well that is easy, just copy "package.json" file, right? , wrong see for some reason this didn't work for me, i was not able to simply do this and restore packages, things went crazy and it seems it's like taking forever!

so i have to come up with something even more "efficient" so here you go, hope this save you sometime and but smile on your face

just execute below on Visual Studio Package Manager Console, setting Default Project to target project might be a good idea.

Get-Package -ProjectName 'SourceProject\LogicalPath\Source.Project.Name' | ForEach-Object { Install-Package -Id $_.Id -Version $_.Versions -Projectname 'TargetProject\LogicalPath\Target.Project.Name' }

Popular posts from this blog

add extra files on deploy ASP Core web app using publish profile

S/MIME Certificate and GMail