4

I try to get an asp.Net 5 mvc running under mono. For the first steps i try to run an Application Template from yo My Steps are :

yo aspnet <- choose WebApplication with name MyWeb

cd MyWeb

kpm restore --source https://www.myget.org/F/aspnetvnext/api/v2/ <- done without errors

kpm build

after that command i got the following errors:

/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'.

this is my 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"]
    }
}

Used Versions are: Mono JIT compiler version 3.12.0 (tarball Sat Feb 7 19:13:43 UTC 2015) KRE: 1.0.0-beta4-11166

Seems like something is wrong with Microsoft.Framework.ConfigurationModel but running out of ideas how to fix this. I hope someone can give me an hint to point me in the right direction!

Thanks a lot for reading! Regards Alex

tereško
  • 58,060
  • 25
  • 98
  • 150
Alex
  • 105
  • 1
  • 7

1 Answers1

2

Not sure about it, but in my VisualStudio MyGet address is "https://www.myget.org/F/aspnetvnext/". Try to use kpm restore with it.

Also, got same errors after VS CTP5->CTP6 update, restore packages from beta2->beta3 had help, so it seems to be wrong package version errors.

Added: If you would get migration error, replace those usings:

/*
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; 
user1981102
  • 21
  • 1
  • 3
  • i tried it with https://www.myget.org/F/aspnetvnext/ but still produced the same error. If i chance the dependencies in project.json to beta2 i got this error ´home/dev/WORKSPACE/MyWeb/MyWeb/Migrations/000000000000000_CreateIdentitySchema.cs(4,40): error CS0234: The type or namespace name 'Migrations' does not exist in the namespace 'Microsoft.Data.Entity.Relational' (are you missing an assembly reference?) ............` – Alex Mar 02 '15 at 12:12
  • I fixed this my moving from beta2 to beta3 on all my packages. – Josh C Mar 03 '15 at 00:35
  • Ah, those kind of error would be fixed pretty simplier. Them change lib struct, so you need to change /*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; Just use IDE, which would show potential fixes like VS. – user1981102 Mar 03 '15 at 09:15
  • Thanks all for your answers, i do still have troubles..i chanced my project.json to -* istead of -beta2 or 3 to get the newest packeges and after that i still got the error about the configuration mentioned in my question. ```The type or namespace name 'IConfiguration' could not be found (are you missing a using directive or an assembly reference?)``` but i have references to Microsoft.Framework.ConfigurationModel in my project.json. have no idea what i'm doing wrong. – Alex Mar 06 '15 at 08:07
  • Seems you still got wrong libs. Just do as you do before - set all libs to beta 2 and change usages as I had answer before. – user1981102 Mar 06 '15 at 12:10