加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

为什么VS编译器在使用嵌套配置文件时抱怨没有找到程序集,但IIS中

发布时间:2020-12-16 09:36:09 所属栏目:asp.Net 来源:网络整理
导读:我现在正在ASP.NET WebForms .NET 3.5中查看web.config,其中所有的主配置文件都是如此突破: configurationsystem.web membership configSource="configmembership.config"/ authentication configSource="configauthentication.config"/ machineKey confi
我现在正在ASP.NET WebForms .NET 3.5中查看web.config,其中所有的主配置文件都是如此突破:

<configuration>
<system.web>
    <membership configSource="configmembership.config"/>
    <authentication configSource="configauthentication.config"/>
    <machineKey configSource="configmachineKey.config"/>
    <compilation debug="true">
        <assemblies>
            <add assembly="System.Design,Version=2.0.0.0,Culture=neutral,PublicKeyToken=B03F5F7F11D50A3A"/>
            <add assembly="System.Web.DataVisualization,Version=3.5.0.0,PublicKeyToken=31BF3856AD364E35"/>
            <add assembly="System.Core,PublicKeyToken=B77A5C561934E089"/>
            <add assembly="System.Web.Extensions,PublicKeyToken=31BF3856AD364E35"/>
            <add assembly="System.Data.DataSetExtensions,PublicKeyToken=B77A5C561934E089"/>
        </assemblies>
    </compilation>
    <customErrors mode="Off"/>
    <authorization>
        <deny users="?"/>
    </authorization>
    <roleManager enabled="true" cacheRolesInCookie="true"/>
    <pages configSource="configpages.config"/>
    <httpHandlers configSource="confighttpHandlers.config"/>
    <httpModules configSource="confighttpModules.config"/>
    <webServices>
        <protocols>
            <add name="HttpGet"/>
            <add name="HttpPost"/>
        </protocols>
    </webServices>
</system.web>
</configuration>

如果我在VS 2010中编译源代码,它会抱怨无法找到.NET DataVisualization库(错误14无法加载文件或程序集’System.Web.DataVisualization,Version = 3.5.0.0,Culture = neutral,PublicKeyToken = 31bf3856ad364e35’或其中一个依赖项.系统找不到指定的文件.sourcecodefile line)如果我用aspnet_compiler编译它或者只是将它放在IIS中,一切正常.

我怎样才能阻止这种情况发生在VS?

我是否必须将这些配置设置带回web.config?

Casini没有这个配置的问题,也没有IIS开发服务器的问题,而且文件不在GAC中(不管是3.5版本,4.0版本),我不会把它放在那里解决这个问题(我将所有内容都移回web.config中,并且dll文件位于bin文件夹中.

解决方法

您需要将System.Web.DataVisualization程序集的引用添加到Visual Studio项目中. Visual Studio不会针对“References”文件夹中未列出的任何程序集进行编译.

在解决方案资源管理器中,在项目下,右键单击“引用”文件夹,然后单击“添加引用…”.

选择并添加缺少的程序集.

问题解决了.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读