2014-02-11 47 views
1

尽管引用存在已经组装,或在构建过程的默认部分中定义,我是 得到类型“System.Linq.IQueryable`1 <T0>”在未被引用

错误1类型'System.Linq.IQueryable`1在未引用的程序集中定义。必须的引用添加到组件“System.Core程序,版本= 4.0.0.0,文化=中性公钥= b77a5c561934e089”

错误2类型“System.Linq.IQueryable”是在组件定义是未引用。必须的引用添加到组件“System.Core程序,版本= 4.0.0.0,文化=中性公钥= b77a5c561934e089”

错误3类型“System.Linq.IQueryProvider”是在组件定义是未引用。您必须添加对程序集“System.Core,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = b77a5c561934e089'的引用'

on Divisions变量名。

public System.Data.Linq.Table<Division> Divisions 
{ 
    get 
    { 
     return this.GetTable<Division>(); 
    } 
} 

这发生在我重新安装visual studio 2013 express for web后。以前编译并且没有错误的项目都会执行完全相同的错误。无法添加它要求的参考,因为它已包含在构建计划中。尝试删除表引用并通过DBML自动生成的代码重新添加,并且最初看起来工作正常......但接下来的列表受到影响,接下来依次类推。如果我全部删除它们并重新添加它们,问题就会重新开始。

我的web.config里乱七八糟的试图杀死这个错误。我已经尝试从头重新创建项目,同样的事情。

<?xml version="1.0" encoding="UTF-8"?> 
<configuration> 
<connectionStrings> 
<add name="GenesisConnectionString" connectionString="Data Source=.\sqlexpress;Initial Catalog=Genesis;Integrated Security=True" providerName="System.Data.SqlClient"/> 
</connectionStrings> 
<appSettings> 
<add key="autoFormsAuthentication" value="false"/> 
<add key="enableSimpleMembership" value="false"/> 
<add key="webpages:Enabled" value="false"/> 
</appSettings> 
<system.web> 
<customErrors mode="Off">   
</customErrors> 
<compilation debug="true" targetFramework="4.0"> 
    <assemblies> 
    <add assembly="System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> 
    <add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 
    <add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 
    <add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 
    <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> 
    <add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, publicKeyToken=b77a5c561934e089" /> 
    <add assembly="System.Data.Services.Client, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/> 
    </assemblies> 
</compilation> 
<pages controlRenderingCompatibilityVersion="4.0"/> 
    <identity impersonate="false"/> 
</system.web> 
<system.webServer> 
<modules runAllManagedModulesForAllRequests="true"/> 
<validation validateIntegratedModeConfiguration="true"/> 
    <handlers> 
     <remove name="cshtm-Integrated-4.0"/> 
     <remove name="cshtml-Integrated-4.0"/> 
     <add name="UrlRoutingHandler" preCondition="integratedMode" verb="*" path="UrlRouting.axd" type="System.Web.HttpForbiddenHandler, 
      System.Web, Version=2.0.0.0, 
      Culture=neutral, 
      PublicKeyToken=31bf3856ad364e35"/> 
     <add name="cshtml-Integrated-4.0" path="*.cshtml" verb="GET,HEAD,POST,DEBUG" type="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" resourceType="Unspecified" requireAccess="Script" preCondition="integratedMode,runtimeVersionv4.0"/> 
     <add name="cshtm-Integrated-4.0" path="*.cshtm" verb="GET,HEAD,POST,DEBUG" type="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" resourceType="Unspecified" requireAccess="Script" preCondition="integratedMode,runtimeVersionv4.0"/> 
    </handlers> 

</system.webServer> 
<runtime> 
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> 
     <dependentAssembly> 
      <assemblyIdentity name="System.Web.WebPages.Razor" publicKeyToken="31BF3856AD364E35" culture="neutral"/> 
      <bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0"/> 
     </dependentAssembly> 
     <dependentAssembly> 
      <assemblyIdentity name="System.Web.WebPages.Deployment" publicKeyToken="31BF3856AD364E35" culture="neutral"/> 
      <bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0"/> 
     </dependentAssembly> 
     <dependentAssembly> 
      <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31BF3856AD364E35" culture="neutral"/> 
      <bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0"/> 
     </dependentAssembly> 
    </assemblyBinding> 
</runtime> 
</configuration> 

这是一个破解VS版本的实例,或者我错过了什么?我是否开始这个项目是错误的,我忘了说klaatu verata nicto?如果它甚至可以完成构建应用程序,我会发布堆栈跟踪。感谢您的帮助!

+1

你的项目没有引用System.Core程序,或参考已损坏。修复。 – Will

+0

'klaatu verata nicto'是什么意思? – Mayank

+0

Klaatu Vrata nikto来自“地球静止的日子”和“黑暗的军队”两个经典。推荐的。该行意在作为一个笑话,与实际问题没有任何关系。 – Originalmouse

回答

2

这是System.Core.dll的确,检查的官方MSDN链接

http://msdn.microsoft.com/en-us/library/bb351562(v=vs.110).aspx

+0

好的。我试图添加该参考。不喜欢它。说:“无法添加对'System.Core'的引用,该组件已经被构建系统自动引用。”所以...有任何技巧来引用它呢? – Originalmouse

+1

向csproj文件添加一行,告诉它 DrinkBird

+1

如果我不直,我会吻你。谢谢,男人! – Originalmouse

相关问题