Asp.net mvc Visual Studio 2015新MVC项目-Microsoft.Aspnet中不存在MVC

Asp.net mvc Visual Studio 2015新MVC项目-Microsoft.Aspnet中不存在MVC,asp.net-mvc,asp.net-mvc-5,visual-studio-2015,Asp.net Mvc,Asp.net Mvc 5,Visual Studio 2015,我在Visual Studio 2015中遇到一个错误 我使用的是windows 8.1和visual studio 2013,所有使用asp.net MVC 5的项目都运行良好,开发过程中没有任何错误 因为我安装了windows 10和visual studio 2015,所以我的整个ASP.NET MVC 5项目都无法正常工作 我在visual studio 2015中创建了新的默认模板来检查它们。我在那些新项目上也犯了同样的错误 我得到的错误如下: CS0234中不存在类型或命名空间名称“

我在Visual Studio 2015中遇到一个错误 我使用的是windows 8.1和visual studio 2013,所有使用asp.net MVC 5的项目都运行良好,开发过程中没有任何错误

因为我安装了windows 10和visual studio 2015,所以我的整个ASP.NET MVC 5项目都无法正常工作

我在visual studio 2015中创建了新的默认模板来检查它们。我在那些新项目上也犯了同样的错误

我得到的错误如下:

CS0234中不存在类型或命名空间名称“Mvc” 命名空间“Microsoft.AspNet”(是否缺少程序集引用?)

当前上下文中不存在名称“布局”

**我已经尝试过的事情:**

  • 修复VS 2015
  • 已从Nuget卸载并安装安装包Microsoft.AspNet.Mvc
  • 复制本地=真
  • System.web.MVC已被引用
  • web.config all places 5.2.3.0的版本

  • Visual Studio 2015也有同样的问题,每次打开ASP.NET 5.0项目时都会出现该错误,但当我再次打开应用程序时,错误就会消失


    顺便说一下,问题似乎与正确的版本控制有关,例如,如果您使用的是ASP.NET 5.0的Beta 7.0,可能有些软件包仍然使用以前的版本,如Beta 5.0,…

    我在%AppData%\Microsoft\VisualStudio\14.0\ActivityLog.xml中遇到此错误:

    <type>Error</type>
    <source>Editor or Editor Extension</source>
    <description>System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---&gt; System.ArgumentException: Item has already been added. Key in dictionary: &apos;RazorSupportedRuntimeVersion&apos;  Key being added: &apos;RazorSupportedRuntimeVersion&apos;&#x000D;&#x000A;   at System.Collections.Hashtable.Insert(Object key, Object nvalue, Boolean add)&#x000D;&#x000A;   at System.Collections.Hashtable.Add(Object key, Object value)&#x000D;&#x000A;   at System.Collections.Specialized.HybridDictionary.Add(Object key, Object value)&#x000D;&#x000A;   at Microsoft.VisualStudio.Utilities.PropertyCollection.AddProperty(Object key, Object property)&#x000D;&#x000A;   at Microsoft.VisualStudio.Html.Package.Razor.RazorVersionDetector.Microsoft.Html.Editor.ContainedLanguage.Razor.Def.IRazorVersionDetector.GetVersion(ITextBuffer textBuffer)&#x000D;&#x000A;   at Microsoft.Html.Editor.ContainedLanguage.Razor.RazorUtility.TryGetRazorVersion(ITextBuffer textBuffer, Version&amp; razorVersion)&#x000D;&#x000A;   at Microsoft.Html.Editor.ContainedLanguage.Razor.RazorErrorTagger..ctor(ITextBuffer textBuffer)&#x000D;&#x000A; 
    
    错误
    编辑器或编辑器扩展
    System.Reflection.TargetInvocationException:调用的目标已引发异常。--System.ArgumentException:已添加项。输入字典:&apos;RazorSupportedRuntimeVersion&apos;正在添加的密钥:&apos;RazorSupportedRuntimeVersion&apos
    ;在System.Collections.Hashtable.Insert(对象键、对象nvalue、布尔加法)和#x000D
    ;在System.Collections.Hashtable.Add(对象键、对象值)和#x000D
    ;在System.Collections.Specialized.HybridDictionary.Add(对象键、对象值)和#x000D
    ;在Microsoft.VisualStudio.Utilities.PropertyCollection.AddProperty(对象键,对象属性)和#x000D
    ;在Microsoft.VisualStudio.Html.Package.Razor.RazorVersionDetector.Microsoft.Html.Editor.ContainedLanguage.Razor.Def.IRazorVersionDetector.GetVersion(ITextBuffer textBuffer)和#x000D
    ;在Microsoft.Html.Editor.ContainedLanguage.Razor.RazorUtility.TryGetRazorVersion(ITextBuffer textBuffer,Version&;razorVersion)和#x000D
    ;在Microsoft.Html.Editor.ContainedLanguage.Razor.RazorErrorTagger..ctor(ITextBuffer textBuffer)和x000D
    ;
    
    我运行了C:\“ProgramFiles(x86)”\“MicrosoftVisualStudio14.0”\Common7\IDE\devenv.exe/resetuserdata,它被修复了


    取自

    我遵循这些步骤,以便完全重新安装解决了问题的Visual Studio 2015。修理不起作用

  • 运行命令

    C:\ProgramFiles(x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.exe/resetuserdata

  • 下载web安装程序安装文件,并在下载的目录中运行以下命令

    vs_community.exe/uninstall/force

  • 卸载后,我确保没有安装与VS相关的文件软件并重新启动PC

  • 使用Web安装程序安装了新的Visual Studio
  • 再次运行该命令

    C:\ProgramFiles(x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.exe/resetuserdata

  • Visual Studio内部提供了更新,已安装这些更新-已重新启动Visual Studio

  • 现在打开任何asp.net mvc解决方案都需要时间,虽然在开始时需要时间,但在那之后就可以工作了


  • 我遇到了这个错误,通过对web.config的
    运行时/assemblyBinding
    部分进行编辑,可以解决它,如下所示:

    <!-- Original //-->
    <dependentAssembly>
        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
      </dependentAssembly>
    
    <!-- Changed to... //-->
     <dependentAssembly>
        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
      </dependentAssembly>
    
    
    
    这可能在主
    web.config
    文件和/或视图目录中


    希望这有帮助

    重新打开项目解决了您的问题。我尝试过重新打开、卸载和加载项目,但仍然收到错误。我尝试过重新打开、卸载和加载项目,但仍然收到错误。在我的应用程序中可能会有这样的情况,软件包使用其他版本,但在我默认的新visual studio 2015项目中也会出现同样的问题。到目前为止,所有建议的解决方案都不起作用。任何其他suggestions@BrilBroeder您是否尝试过重新安装我发布的解决方案visual studio?@ShanKhan re-install成功了。谢谢。但是VS2015在Win10上仍然非常慢。但这是另一个我有时间时必须研究的问题:-)@BrilBroeder您是否尝试过重置用户数据?这可能会有帮助。有时,扩展会造成意外的行为。是的,我没有完成这项工作。