我正在使用 Visual Studio 2015 社区版并将我现有的 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"
]
}