Exception on opening existing project after ugradi

2019-06-27 09:57发布

问题:

I'm using Visual Studio 2015 Community Edition and updated my existing ASP.NET MVC6 application to beta7. Now I'm not able to open the project anymore. Visual Studio crashes with the following Exception:

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()<---

Googling for the error message The specified default content type (Default) is not defined in the project item schema. didn't brought any helpful hint. First I thought it has something to do with the dnvm. So this is my dnvm list result:

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

My global.json looks like this:

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

Removing the sdk part does not change anything.

EDIT: this is my 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:

I had exactly the same problem. I tried reinstalling the Web Tools as well as repairing VS (Professional).

File->New Project threw the same error.

My solution was to install the german language pack (I am using german Visual Studio). The problem was, that when I first installed beta7 the language pack aborted with an error that I cannot remember, but when I retried, it worked.

Regards Daniel