I created a small project in Visual Studio 2019 that uses the content of a NuGet package (SQLite). When I build my project in Visual Studio and run it in debug mode, everything works fine. But when I copy the built files from the output directory to another directory or to another computer it fails, telling me, that it's not finding files from the NuGet package.
For the NuGet package I'm using it's missing two files. When I'm copying these two missing files from the NuGet package directory to my project files, it's working again.
But is this really the way to go? Let's say my project is getting bigger and is needing more and more NuGet packages, do I really have to guess for every NuGet package, which files I might need from it and where I might find these files on my hard drive?
Another thing is that I found the files from the NuGet package somewhere in my Windows user directory, not in my code directory. So, if I'll archive my code and give it to someone else or use it some time later, the NuGet packages are missing from the code.
So, here are my questions:
1) Is there a way to tell Visual Studio to copy all the necessary files from all used NuGet packages to the output directory automatically?
2) Is it possible to store the downloaded NuGet packages somewhere closer to my source code instead of in my windows user directory? I'd like to just archive one directory to backup all of my source code.
I took a quick look on post build events to maybe copy all the missing files to the output directory in a post build event, but that's can't be the way to go, since I still need the knowledge exactly which files I need to copy and where to find them, and the path to said files might change from computer to computer.