使用的NuGet在ASP.NET&QUOT * .dll.refresh文件;网站"与Web部署项目项目 [英] Using NuGet with *.dll.refresh files in ASP.NET "Web Site" projects with Web Deployment Projects

查看:189
本文介绍了使用的NuGet在ASP.NET&QUOT * .dll.refresh文件;网站"与Web部署项目项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果你有一个ASP.NET网站项目类型(一个没有正确的.csproj的或.vpproj项目文件,并且仅仅是一个松散的文件夹),那么当你的NuGet添加软件包,它使*在Bin目录.dll.refresh文件以引用包的DLL在父包文件夹中。

If you have an ASP.NET Web Site project type (the one without a proper .csproj or .vpproj project file and that is just a folder of loose files), then when you add a package with NuGet, it makes a *.dll.refresh file in the Bin directory to reference the package's dll in the parent packages folder.

例如,如果执行安装包ELMAH从包管理器控制台,然后ELMAH被放置在项目的解决方案目录中的包文件夹,​​该文件Elmah.dll.refresh放置在项目的Bin文件夹

For example, if you execute "install-package elmah" from the Package Manager Console, then Elmah is placed in the packages folder in the project's solution directory, and the file Elmah.dll.refresh is placed in the project's Bin folder.

当我建立本地项目时,Visual Studio会自动拉在被刷新文件中引用的DLL。该网站与ELMAH正常运行。我没有在该项目的Bin目录坐镇签入到源代码控制(仅刷新文件,并检查了包文件夹)的文件Elmah.dll

When I build the project locally, Visual Studio automatically pulls in the DLL referenced by the refresh file. The site and Elmah run correctly. I don't have the Elmah.dll file that sits in the project's Bin directory checked in to source control (only the refresh file and the packages folder are checked in).

不过,我使用的Web部署项目以pre-编译网站和部署做的web.config替换。当解决方案建立这样,Elmah.dll不会自动拉入到网站项目Bin目录,该网站不能正常​​运行,因为缺少DLL的。

However, I'm using Web Deployment Projects to pre-compile the site and do web.config substitutions for deployments. When the solution is built this way, Elmah.dll is not automatically pulled in to the web site project Bin directory and the site doesn't run correctly because of the missing DLL.

如何的NuGet打算在这种场景中要使用的?是我想在Elmah.dll检查在Bin目录?

How is NuGet intended to be used in this kind of scenario? Am I suppose to check in Elmah.dll in the Bin directory?

推荐答案

这是上面的基础上的GC。解决方案。
添加一个类库(的csproj),并引用该类库中的网站项目。
该包的NuGet添加到类库。
在类库,实际上引用的NuGet包在某些类文件即可。也许创建一个一次性实例或什么的。可以使用的包中包含的任何类。这迫使该.dll被复制到网站项目的bin目录。

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.

这篇关于使用的NuGet在ASP.NET&QUOT * .dll.refresh文件;网站"与Web部署项目项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆