在升级到ASP.NET MVC6 beta7之后打开现有项目的例外

时间:2015-09-08 19:12:43

标签: c# visual-studio-2015 asp.net-core asp.net-core-mvc dnvm

我正在使用Visual Studio 2015 Community Edition并将我现有的ASP.NET MVC6应用程序更新为beta7。现在我不能再打开项目了。 Visual Studio崩溃时出现以下异常:

08.09.2015 20:23:12
Crippling
System.AggregateException: One or more errors occurred. ---> Microsoft.Assumes+InternalErrorException: The specified default content type (Default) is not defined in the project item schema.
   at Microsoft.Assumes.Fail(String message, Boolean showAssert)
   at Microsoft.VisualStudio.ProjectSystem.Items.ProjectItemSchemaManagerBase.<ComputeCacheDataAsync>d__15.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.ProjectSystem.Items.ProjectItemSchemaManager.<CreateSchemaFromSnapshotDataAsync>d__21.MoveNext()
   --- End of inner exception stack trace ---
---> (Inner Exception #0) Microsoft.Assumes+InternalErrorException: The specified default content type (Default) is not defined in the project item schema.
   at Microsoft.Assumes.Fail(String message, Boolean showAssert)
   at Microsoft.VisualStudio.ProjectSystem.Items.ProjectItemSchemaManagerBase.<ComputeCacheDataAsync>d__15.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.ProjectSystem.Items.ProjectItemSchemaManager.<CreateSchemaFromSnapshotDataAsync>d__21.MoveNext()<---

搜索错误消息未在项目项架构中定义指定的默认内容类型(默认)。未提供任何有用的提示。首先我认为它与dnvm有关。这是我的dnvm list结果:

Active Version     Runtime Architecture OperatingSystem Alias
------ -------     ------- ------------ --------------- -----
       1.0.0-beta5 clr     x64          win
       1.0.0-beta5 clr     x86          win
       1.0.0-beta5 coreclr x64          win
       1.0.0-beta5 coreclr x86          win
       1.0.0-beta6 clr     x64          win
       1.0.0-beta6 clr     x86          win
       1.0.0-beta7 clr     x64          win
  *    1.0.0-beta7 clr     x86          win             default
       1.0.0-beta7 coreclr x64          win
       1.0.0-beta7 coreclr x86          win

我的global.json看起来像这样:

{
    "projects": [ "src", "test" ],
    "sdk": {
        "version": "1.0.0-beta7"
    }
}

删除 sdk 部分不会改变任何内容。

编辑:这是我的project.json

{
    "webroot": "wwwroot",
    "version": "1.0.0-*",

    "dependencies": {
        "Microsoft.AspNet.Mvc": "6.0.0-*",
        "Microsoft.AspNet.Server.IIS": "1.0.0-*",
        "Microsoft.AspNet.Server.WebListener": "1.0.0-*",
        "Microsoft.AspNet.StaticFiles": "1.0.0-*",
        "Microsoft.AspNet.Diagnostics": "1.0.0-*",
        "Microsoft.Framework.Configuration.Json": "1.0.0-*",
        "Microsoft.AspNet.Authentication": "1.0.0-*"
    },

    "commands": {
        "web": "Microsoft.AspNet.Hosting --config hosting.ini"
    },

    "frameworks": {
        "dnx451": { },
        "dnxcore50": { }
    },

    "compilationOptions": {
        "allowUnsafe": true
    },

    "exclude": [
        "wwwroot",
        "node_modules",
        "bower_components"
    ],
    "publishExclude": [
        "node_modules",
        "bower_components",
        "**.xproj",
        "**.user",
        "**.vspscc"
    ]
}

1 个答案:

答案 0 :(得分:6)

我有完全相同的问题。我尝试重新安装Web工具以及修复VS(专业版)。

File-&gt; New Project投掷了同样的错误。

我的解决方案是安装德语语言包(我使用的是德语Visual Studio)。问题是,当我第一次安装beta7时,语言包因为我记不起来的错误而中止,但是当我重试时,它起作用了。

问丹尼尔