Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Asp.Net Core RC2 with Microsoft.Owin

Could not compile project while adding using Microsoft.Owin; line at Startup.cs. VS throws an error: ASP.NET Core 5.0 error CS0234: The type or namespace name 'Owin' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) Here is my project.json file:

{
    "webroot": "wwwroot",
    "version": "1.0.0-*",
    "dependencies": {
        "Microsoft.AspNet.Mvc": "6.0.0-beta3",
        "Microsoft.AspNet.Server.IIS": "1.0.0-beta3",
        "Microsoft.Owin": "3.0.1",
        "Microsoft.Owin.Security": "3.0.1",
        "Microsoft.Owin.Security.OAuth": "3.0.1",
        "Microsoft.Owin.Security.Cookies": "3.0.1"
    },
    "frameworks": {
        "aspnetcore50": {}
    },
    "bundleExclude": [
        "node_modules",
        "bower_components",
        "**.kproj",
        "**.user",
        "**.vspscc"
    ],
    "exclude": [
        "wwwroot",
        "node_modules",
        "bower_components"
    ]
}

Am I missing something?

Prerequisites: Visual Studio 2015 CTP version 14.0.22609.0 D14REL, Empty ASP.NET 5 Preview template

like image 607
Alex Kroshner Avatar asked Dec 05 '25 10:12

Alex Kroshner


1 Answers

It seems that the Owin libraries (version 3.0.1) are not compatible with Microsoft's new Core version of the .NET framework.

To fix this you can change your frameworks entry from aspnetcore50 to aspnet50 which runs your application using the full .NET framework rather than the core version.

I've just started exploring ASP 5 as well and have found the examples here useful: https://github.com/aspnet/Home/tree/dev/samples/1.0.0-beta4/HelloMvc

Edit: Now that the VS 2015 RC is out this has changed again. You will now use dnx451 / dnxcore451 as your target frameworks.

like image 79
James Hulse Avatar answered Dec 06 '25 23:12

James Hulse



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!