I have two projects under one solution. One is an ASP.NET Web Application project, the other is a Class Library. The Web app project is my startup solution, and it has the class library project as a dependency.
In the class library project, I've added some new packages from our internal nuget server, as well as some required dependencies for these packages. For the sake of ease let's just say there's NugetPackage1, and NugetPackage2. NugetPackage1 depends on NugetPackage2, but I do not directly use NugetPackage2 anywhere in my class library project.
When I build the solution, I see NugetPackage1 and NugetPackage2 both in my bin folder for the class library. However, in my website project's bin folder I only see NugetPackage1.
I'm fairly certain it's automatically cleansing "unused" references, because when I directly use a class from NugetPackage2 in my class library and rebuild, it shows up in my website bin. What can I do about this?
Your problem is that you're relying on the build but you need to publish. One thing you can do is to add the following to your ASP.NET project
You probably already have the
PropertyGroup, so you just need to addOutDirOnce you build it (for release, as shown above), you should find folder
_PublishedWebsites, and your DLL should be either there or directly inwebOutputfolder. In case you you don't see it under former and only see it in latter, you can add post-build event to copy it into_PublishedWebsitesThe bottom line, to have all necessary DLLs collected into bin, you need to Publish rather than Build.