Using NuGet with *.dll.refresh files in ASP.NET “Web Site” projects with Web Deployment Projects

北慕城南 提交于 2019-11-28 07:02:25

This is based on GC.'s solution above. Add a class library (csproj) and reference that class library in the website project. Add the nuget packages to the class library. In the class library, actually reference the nuget packages in some class file. Maybe create a throwaway instance or something. You can use any class that's contained in the package. This forces the .dll to be copied to the Bin directory in the web site project.

-- EDIT -- See updated version of this solution above.

Just add a class library project to the solution, and add a reference to the class library project to your website.

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

When your website builds, it pulls in all the class libraries' dependencies in turn.

I'm guessing the pre-compilation doesn't update the DLLs using the .refresh file - maybe that's done by Visual Studio.

If you can't find a way to do it, you could create a build step that copies the DLLs into the bin folder manually, or if you're trying to avoid two copies of the DLLs, maybe you could check in the bin folder and not the packages one. You can use NuGet.exe to re-fetch the packages, populating the packages folder (see here and here)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!