I am using UnityVS and want to use nuget pacakges. However every time my project is regenerated I lose the packages. Is there a way to add references to external libraries with UnityVS without losing them every time they’re regenerated?
I think you can do this by adding a new project to your solution, alongside the four default ones (Unity.CSharp, Unity.CSharpFirstPass, etc). Add the NuGet packages to this new project and then have the other projects reference the new project.
I didn’t realise UnityVS would cater for extra csproj
s automagically. Thanks a lot, I will give it a try.
Thank you @makeshiftwings the .sln file keeps the references to the CS Projects.
However I can’t add reference one of those CS projects without UnityVS’ Generate Project Files menu item removing them each time. Any way to keep them?
Did it!
I changed the output path of my class library to a location in my Assets folder. The main csproj automatically adds it in.
Thanks to this article: UnityVS
Adding the DLL to Assets like you did will work, but also you can add a project to the solution, and just not click “Generate Project Files”, as that does indeed delete and re-create the solution. I usually only click that if somehow the project files stop working. But if you don’t click that, you can add and remove files within Unity and it will automatically regenerate the main csproj files but it won’t regenerate the sln file.