Asp.Net Core RC2 with Microsoft.Owin
Failed to compile project when adding line using Microsoft.Owin;
to 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 file project.json
:
{
"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"
]
}
Did I miss something?
Prerequisites: Visual Studio 2015 CTP version 14.0.22609.0 D14REL, blank ASP.NET 5 Preview template
source to share
It looks like the Owin libraries (version 3.0.1) are incompatible with the new version of Microsoft Core Framework .NET.
To fix this, you can change the frameworks entry from aspnetcore50
to aspnet50
, which runs your application using the full .NET framework rather than the main version.
I just started learning ASP 5 and found some useful examples here: https://github.com/aspnet/Home/tree/dev/samples/1.0.0-beta4/HelloMvc
Edit: Now that VS 2015 RC is disabled, this has changed again. You are now using dnx451
/ dnxcore451
as target frameworks.
source to share
In RC2 asp.net cores use
"Microsoft.AspNetCore.Owin": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Cors": "1.0.0-rc2-final",
and
"Microsoft.AspNetCore.Authentication": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Authentication.OAuth": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Authentication.Cookies: "1.0.0-rc2-final",
Never use Microsoft.Owin...
ASP.NET in core - they are for traditional ASP.NET applications.
source to share