本文介绍了是什么web.config中装配元件和项目文件参考元素之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

,我注意到有定义成两个地方集会。在web.config中存在配置/的System.Web /编译/组件/添加元素。在项目文件中有项目/的ItemGroup /参考要素下引用设置。

I'm looking at an asp.net application, i notice that there are assemblies defined into two places. In web.config there is configuration/system.web/compilation/assemblies/add elements. In the project file there are references setup under the Project/ItemGroup/Reference elements.

我想知道,什么是组件/引用在任一位置添加有何区别?

I was wondering, what is the difference between assemblies/references added in either location?

推荐答案

在web.config节

in the web.config section

大会元素定义ASP.NET应用程序的编译过程中使用的组件名称的集合。

大会元素我们一般在网站项目中使用,因为没有项目文件存储,该网站使用的参考位置。该项目引用不适用于一个网站,因为它没有合适的项目文件来存储这些中,因此必须存储在web.config中的所有引用的程序集。有一些有趣的,尽管没有直接的关系,讨论here.在Web应用程序项目时,可以同时使用组件元素和项目的引用。

The assemblies element us usually used in web site projects as there is no project file storing location of references that the web site uses. The project references would not apply to a web site, as it has no proper project file to store these in, so must store all referenced assemblies in the web.config. There is some interesting, although not directly related, discussion here. In a web application project you can use both the assemblies element and project references.

具有大会元素的引用也意味着你将不必在使用该命名空间的任何.aspx页的顶部添加@Register。这里上更多的讨论。

Having a reference in the assemblies element also means you won't have to add the @register at the top of any .aspx pages that use that namespace. More discussion on that here.

这篇关于是什么web.config中装配元件和项目文件参考元素之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!