我们正在使用Visual Studio Code开发我们的第一个ASP.NET 5项目。我们已经安装了DNVM和DNX。我们还从ASP.NET的GitHub帐户中查看了NewMVC6Project。此外,我们在project.json中配置了我们的Web服务器,如下所示。
{
"webroot": "wwwroot",
"version": "1.0.0-*",
"dependencies": {
"Microsoft.AspNet.Server.IIS": "1.0.0-beta4",
"Microsoft.AspNet.Server.WebListener" : "1.0.0-beta4",
"Microsoft.AspNet.Mvc": "6.0.0-beta4",
"Microsoft.Framework.ConfigurationModel.Json": "1.0.0-beta4"
},
"frameworks": {
"dnx451": { },
"dnxcore50": { }
},
"bundleExclude": [
"node_modules",
"bower_components",
"**.kproj",
"**.user",
"**.vspscc"
],
"commands": {
"web": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.WebListener --server.urls http://localhost:5001"
},
"exclude": [
"wwwroot",
"node_modules",
"bower_components"
]
}
此外,当我们运行dnvm list
时,我们会收到此输出。
Active Version Runtime Architecture Location Alias
------ ------- ------- ------------ -------- -----
* 1.0.0-beta4 clr x86 C:\Users\BigFont\.dnx\runtimes default
但是,在Visual Studio Code中打开项目文件夹时,我们仍会收到此错误。
> The specified runtime path '1.0.0-beta3' does not exist. Searched locations %USERPROFILE%\.dnx\runtimes\dnx-clr-win-x86.1.0.0-beta3
为什么要寻找1.0.0-beta3而不是1.0.0-beta4?我们如何解决这个问题?
答案 0 :(得分:1)
问题出在我们的global.json文件中。目录结构如下:
NewMVC6Project
src
NewMVC6Project
project.json
other-stuff-omitted
global.json
NewMvc6Project.sln
即使project.json已正确配置,global.json也需要更改:
{
"sources": [ "src", "test" ],
"sdk": {
"version": "1.0.0-beta3"
}
}
......对此:
{
"sources": [ "src", "test" ],
"sdk": {
"version": "1.0.0-beta4"
}
}