如何从web.config中引用组装? [英] How to reference assembly from web.config?

查看:306
本文介绍了如何从web.config中引用组装?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要添加引用system.xml.dll的'组装成的web.config(以争取问题的解决,这里所说的:的与扩展方法问题:IXmlLineInfo

I need to add reference to 'System.XML.dll' assembly into web.config (in order to try solution for problem, mentioned here: Problem with Extension method: IXmlLineInfo).

我试着以下行加入到组件部分:

I've tried to add the following line into "assemblies" section:

<add assembly="System.Xml, Version=2.0.5.0, Culture=neutral,
     PublicKeyToken=7cec85d7bea7798e"/>

这导致了错误:

描述:时发生错误   一个配置文件的处理   该请求提供服务所需。   请查看具体的错误   下面和修改详细信息,请   配置文件正确。

Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

分析器错误信息:未能加载   文件或程序集的System.Xml,   版本= 2.0.5.0,文化=中立,   公钥= 7cec85d7bea7798e或   它的一个依赖。在位于   集清单定义呢   不匹配的程序集引用。   (从HRESULT异常:0x80131040)

Parser Error Message: Could not load file or assembly 'System.Xml, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

说实话,我不知道,如果版本/文化/公钥是否正确指定。

To be honest, I not sure if version/Culture/PublicKeyToken are specified correctly.

我有几个不同的版本system.xml.dll的的:

I have few different versions of System.XML.dll:

  • C:\ Program Files文件(x86)的\参考大会\微软\ Framework.NETFramework \ V3.5 \档案\客户端\ system.xml.dll的
  • C:\ Program Files文件(x86)的\参考大会\微软\ Framework.NETFramework \ V4.0 \档案\客户端\ system.xml.dll的
  • C:\ Program Files文件(x86)的\参考大会\微软\ Framework.NETFramework \ V4.0 \ system.xml.dll的
  • C:\ Program Files文件(x86)的\参考大会\微软\框架\ Silverlight的\ 3.0 \ system.xml.dll的
  • C:\ Program Files文件(x86)的\参考大会\微软\框架\ Silverlight的\ V4.0 \ system.xml.dll的

另外,我有一些组件在GAC的框架,框架64,等等...

Also I have some assemblies in GAC in Framework, Framework x64, etc...

问题1:

这集我需要?

问题2:(过时)

如何确定确切的程序集版本和公钥?

How to determine exact assembly version and publicKeyToken?

P.S。有趣的事情,当我张贴的问题我发现有一个publickkeytoken标记已经和它包含的答案问题2:)

P.S. Funny things, when I posted question I've found that there is a 'publickkeytoken' tag already and it contains answer for Question2 :)

非常感谢!

推荐答案

如果您正在使用Visual Studio,那么你可以通过右键点击你的项目 - >添加参考 - >在.NET选项卡,你会发现,装配做到这一点。

If you are using Visual Studio, then you can do it by Right clicking your Project-> Add Reference->Under .NET tab you will find that assembly.

如何通过VS 添加集引用。

根据项目即网站或WebApplication的VS的类型要么添加一个条目web.config文件或DLL添加到您的bin文件夹。

Depending on the type of project i.e WebSite or WebApplication VS will either add an entry to web.config or add the dll to your bin folder.

现在,你需要哪一个(2.0 / 3.5 / 4.0),取决于你的应用程序。

Now which one you need(2.0/3.5/4.0) depends on your application.

这篇关于如何从web.config中引用组装?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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