Using NuGet with * .dll.refresh Files in ASP.NET Website Projects with Web Deployment Projects

If you have an ASP.NET Web Site project project (one who does not have the proper project file .csproj or .vpproj, and this is just a folder with files), then when you add the package with NuGet, it makes * .dll. refresh in the Bin directory to reference the package DLL in the parent package folder.

For example, if you run "install-package elmah" from the package manager console, then Elmah is placed in the packages folder in the project solution directory, and the Elmah.dll.refresh file is placed in the Bin folder of the project.

When I create a project locally, Visual Studio automatically inserts the DLL referenced by the update file. The site and Elmah are working correctly. I do not have the Elmah.dll file, which is located in the Bin directory of the project installed in the source control (only in the update file and in the package folder).

However, I use web deployment projects to precompile the site and perform web.config substitutions for deployments. When the solution is constructed in this way, Elmah.dll is not automatically pulled into the Bin directory of the website project and the website is not working properly due to the missing DLL.

How is NuGet intended to be used in this scenario? I suppose to check the Elmah.dll file in the bin directory?

+8
nuget build-server web-deployment-project
source share
3 answers

It is based on the GC. The solution is higher. Add a class library (csproj) and specify this class library in the website project. Add nuget packages to the class library. The class library does refer to nuget packages in the class file . Maybe create a random instance or something like that. You can use any class contained in the package. This causes the .dll file to be copied to the Bin directory in the website project.

+8
source share

- EDIT - see the updated version of this solution above.

Just add the class library project to the solution and add the link to the class library project to your website.

Then add nuget to the class library, not the website project.

When your site builds, it takes turns using all the library library dependencies.

+4
source share

I assume that precompilation does not update the DLLs using the .refresh file - perhaps this was done using Visual Studio.

If you cannot find a way to do this, you can create a build step that copies the DLLs to the bin folder manually, or if you are trying to avoid two copies of the DLL, perhaps you can check the bin folder, not the packages. You can use NuGet.exe to re-select packages, fill in the package folder (see here and here )

0
source share

All Articles