我在我的应用程序中使用VS2015和DNX 1.0.0-beta6,并且我正在尝试使用命令行代码生成生成一个空控制器并遇到以下错误。需要帮助。
d:\Project>dnx . gen controller -name PersonController
Finding the generator 'controller'...
Running the generator 'controller'...
Method not found: 'Microsoft.AspNet.Razor.GeneratorResults Microsoft.AspNet.Razor.RazorTemplateEngine.GenerateCode(System.IO.TextReader)'
我的project.json看起来像这样
{
"webroot": "wwwroot",
"version": "1.0.0-*",
"dependencies": {
"Microsoft.AspNet.Diagnostics": "1.0.0-beta6",
"Microsoft.AspNet.Mvc": "6.0.0-beta6",
"Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-beta6",
"Microsoft.AspNet.Server.IIS": "1.0.0-beta6",
"Microsoft.AspNet.Server.WebListener": "1.0.0-beta6",
"Microsoft.AspNet.StaticFiles": "1.0.0-beta6",
"Microsoft.AspNet.Tooling.Razor": "1.0.0-beta6",
"Microsoft.Framework.Configuration.Json": "1.0.0-beta6",
"Microsoft.Framework.Logging": "1.0.0-beta6",
"Microsoft.Framework.Logging.Console": "1.0.0-beta6",
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-beta6",
"EntityFramework.Core": "7.0.0-beta6",
"EntityFramework.Commands": "7.0.0-beta6",
"EntityFramework.SqlServer": "7.0.0-beta6",
"Microsoft.Framework.CodeGeneration": "1.0.0-beta5",
"Microsoft.Framework.CodeGenerators.Mvc": "1.0.0-beta5"
},
"commands": {
"web": "Microsoft.AspNet.Hosting --config hosting.ini",
"gen": "Microsoft.Framework.CodeGeneration",
"ef": "EntityFramework.Commands"
},
"frameworks": {
"dnx451": {
"dependencies": {
"EntityFramework.Core": "7.0.0-beta5"
}
},
"dnxcore50": { }
},
"exclude": [
"wwwroot",
"node_modules",
"bower_components"
],
"publishExclude": [
"node_modules",
"bower_components",
"**.xproj",
"**.user",
"**.vspscc"
],
"scripts": {
"prepublish": [ "npm install", "bower install", "gulp clean", "gulp min" ]
}
}
答案 0 :(得分:2)
您无法使用beta5
和Microsoft.Framework.CodeGeneration
的{{1}},因为它们依赖于与您拥有的其他依赖项冲突的beta5基础架构。
目前,这些套餐的beta6尚未发布或发布。
有一个github问题跟踪:
https://github.com/aspnet/Scaffolding/issues/105
当答复时,我们将知道它是否会被修复。
此时,要使用脚手架,您必须返回Microsoft.Framework.CodeGenerators.Mvc
。
更新:另一种选择是使用beta5
Feed:https://www.myget.org/gallery/aspnetmaster