gpt4 book ai didi

asp.net-mvc - asp.net 5 (vnext) build IConfiguration 丢失

转载 作者:太空狗 更新时间:2023-10-29 11:18:44 25 4
gpt4 key购买 nike

我尝试让 asp.Net 5 mvc 在单声道下运行。对于第一步,我尝试从 yo 运行应用程序模板我的步骤是:

yo aspnet <- 选择名为 MyWeb 的 WebApplication

cd MyWeb

kpm restore --source https://www.myget.org/F/aspnetvnext/api/v2/ <- 没有错误完成

每分钟构建

执行该命令后出现以下错误:

/home/dev/WORKSPACE/MyWeb/MyWeb/Startup.cs(29,16): error CS0246: The type or namespace name 'IConfiguration' could not be found (are you missing a using directive or an assembly reference?) /home/dev/WORKSPACE/MyWeb/MyWeb/Startup.cs(32,39): error CS0246: The type or namespace name 'IServiceCollection' could not be found (are you missing a using directive or an assembly reference?) /home/dev/WORKSPACE/MyWeb/MyWeb/Startup.cs(59,56): error CS0246: The type or namespace name 'IHostingEnvironment' could not be found (are you missing a using directive or an assembly reference?) /home/dev/WORKSPACE/MyWeb/MyWeb/Startup.cs(59,81): error CS0246: The type or namespace name 'ILoggerFactory' could not be found (are you missing a using directive or an assembly reference?) /home/dev/WORKSPACE/MyWeb/MyWeb/Startup.cs(21,24): error CS0246: The type or namespace name 'IHostingEnvironment' could not be found (are you missing a using directive or an assembly reference?) /home/dev/WORKSPACE/MyWeb/MyWeb/Models/IdentityModels.cs(21,37): error CS0246: The type or namespace name 'IHostingEnvironment' could not be found (are you missing a using directive or an assembly reference?) /home/dev/WORKSPACE/MyWeb/MyWeb/Startup.cs(24,29): error CS0012: The type 'IConfigurationSourceContainer' is defined in an assembly that is not referenced. You must add a reference to assembly 'Microsoft.Framework.ConfigurationModel.IConfigurationSourceContainer, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. /home/dev/WORKSPACE/MyWeb/MyWeb/Startup.cs(40,17): error CS0012: The type 'IServiceCollection' is defined in an assembly that is not referenced. You must add a reference to assembly 'Microsoft.Framework.DependencyInjection.IServiceCollection, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. /home/dev/WORKSPACE/MyWeb/MyWeb/Startup.cs(46,13): error CS0012: The type 'IServiceCollection' is defined in an assembly that is not referenced. You must add a reference to assembly 'Microsoft.Framework.DependencyInjection.IServiceCollection, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. /home/dev/WORKSPACE/MyWeb/MyWeb/Startup.cs(50,13): error CS0012: The type 'IServiceCollection' is defined in an assembly that is not referenced. You must add a reference to assembly 'Microsoft.Framework.DependencyInjection.IServiceCollection, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. /home/dev/WORKSPACE/MyWeb/MyWeb/Startup.cs(63,13): error CS0012: The type 'ILoggerFactory' is defined in an assembly that is not referenced. You must add a reference to assembly 'Microsoft.Framework.Logging.ILoggerFactory, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.

这是我的 project.json:

{
/* Click to learn more about project.json http://go.microsoft.com/fwlink/?LinkID=517074 */
"webroot": "wwwroot",
"version": "1.0.0-*",
"dependencies": {
"EntityFramework.SqlServer": "7.0.0-beta3",
"EntityFramework.Commands": "7.0.0-beta3",
"Microsoft.AspNet.Mvc": "6.0.0-beta3",
/* "Microsoft.AspNet.Mvc.WebApiCompatShim": "6.0.0-beta3", */
"Microsoft.AspNet.Diagnostics": "1.0.0-beta3",
"Microsoft.AspNet.Diagnostics.Entity": "7.0.0-beta3",
"Microsoft.AspNet.Identity.EntityFramework": "3.0.0-beta3",
"Microsoft.AspNet.Security.Cookies": "1.0.0-beta3",
"Microsoft.AspNet.Server.IIS": "1.0.0-beta3",
"Microsoft.AspNet.Server.WebListener": "1.0.0-beta3",
"Microsoft.AspNet.StaticFiles": "1.0.0-beta3",
"Microsoft.Framework.ConfigurationModel.Json": "1.0.0-beta3",
"Microsoft.Framework.CodeGenerators.Mvc": "1.0.0-beta3",
"Microsoft.Framework.Logging": "1.0.0-beta3",
"Microsoft.Framework.Logging.Console": "1.0.0-beta3",
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-beta3",
/* Modifications for Mono Support*/
"EntityFramework.InMemory": "7.0.0-beta3",
"Kestrel": "1.0.0-beta3"
},
"commands": {
/* Change the port number when you are self hosting this application */
"web": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.WebListener --server.urls http://localhost:5001",
"kestrel": "Microsoft.AspNet.Hosting --server Kestrel --server.urls http://localhost:5004",
"gen": "Microsoft.Framework.CodeGeneration",
"ef": "EntityFramework.Commands"
},
"frameworks": {
"aspnet50": {},
"aspnetcore50": {}
},
"exclude": [
"wwwroot",
"node_modules",
"bower_components"
],
"bundleExclude": [
"node_modules",
"bower_components",
"**.kproj",
"**.user",
"**.vspscc"
],
"scripts": {
"postrestore": ["npm install"],
"prepare": ["grunt bower:install"]
}
}

使用的版本是:Mono JIT 编译器版本 3.12.0(tarball Sat Feb 7 19:13:43 UTC 2015)KRE: 1.0.0-beta4-11166

似乎 Microsoft.Framework.ConfigurationModel 出了点问题,但想不出如何解决这个问题。我希望有人能给我一个提示,让我指明正确的方向!

非常感谢阅读!问候亚历克斯

最佳答案

不确定,但在我的 VisualStudio MyGet 地址是“https://www.myget.org/F/aspnetvnext/”。尝试将 kpm restore 与它一起使用。

此外,在 VS CTP5->CTP6 更新后出现同样的错误,从 beta2->beta3 恢复包有帮助,所以它似乎是错误的包版本错误。

添加:如果您遇到迁移错误,请替换这些用法:

/*
using Microsoft.Data.Entity.Migrations;
using Microsoft.Data.Entity.Migrations.Builders;
using Microsoft.Data.Entity.Migrations.Infrastructure;
*/

using Microsoft.Data.Entity.Relational.Migrations;
using Microsoft.Data.Entity.Relational.Migrations.Builders;
using Microsoft.Data.Entity.Relational.Migrations.Infrastructure;

关于asp.net-mvc - asp.net 5 (vnext) build IConfiguration 丢失,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28807647/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com