How to deploy project with new NuGet package

Don Rea asked on June 29, 2022 18:35

I'm back with another question that I'm sure is because I'm a developer/newbie with little background in managing CMSs and servers and web sites. For the last eight months or so that we've been responsible for the Kentico 11 site we took over, when modifying code that gets compiled into a project DLL within the solution, we've simply built the project and copied the DLL to the testing and, eventually, production environments. This has worked fine until now. But we added a new project and installed a NuGet package into that project that isn't referred to in any other project in the site. Now, when testing in any environment other than the development site, when execution gets to anything that refers to the namespace of that package ASP throws an Exception with the message CS0246: The type or namespace name 'net' could not be found (are you missing a using directive or an assembly reference?) (the first element of the namespace is, indeed, net).

Obviously we need to do something additional to get the NuGet package into the deployment environments, but I have no idea what. When I search the test site for files ending in .nupkg there is nothing, even though I know for a fact that there are dozens of NuGet packages included in the site solution. So I guess it's not as simple as copying the file.

The only possibility I've found so far is deploying the site from Visual Studio, which is not really an option for us because the development/test network cannot connect to the production network. (There is a separate deployment process for moving files across those networks.)

What do we need to do to get the NuGet package logic to travel along with the DLL that depends on it?

Recent Answers


Don Rea answered on June 29, 2022 19:56

Apparently when installing a NuGet package, the DLL for that package is copied to the site solution's bin directory, and can simply be copied along with the project DLL. Very simple once you know, but very hard to Google if you don't know.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.