Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

k web: RoslynCompilationException error CS0433 #291

Closed
kscott5 opened this issue Jan 25, 2015 · 4 comments
Closed

k web: RoslynCompilationException error CS0433 #291

kscott5 opened this issue Jan 25, 2015 · 4 comments

Comments

@kscott5
Copy link

kscott5 commented Jan 25, 2015

I understanding how KRuntime does first package win when resolving dependencies but I'm at a loss with this. I starting to believe SQL Server Local would be better than trying to address this MongoDB? Any thoughts?

PS G:\apps\pcsc\GreenShelter\src\mvc> k web
System.IO.FileLoadException: Could not load file or assembly 'mvc' or one of its dependencies. Gener
al Exception (Exception from HRESULT: 0x80131500)
File name: 'mvc' ---> Microsoft.Framework.Runtime.Roslyn.RoslynCompilationException: G:\apps\pcsc\Gr
eenShelter\src\mvc\Models\ApplicationRoleManager.cs(7,40): error CS0433: The type 'RoleManager<TRole
>' exists in both 'Microsoft.AspNet.Identity.Core, Version=2.0.0.0, Culture=neutral, PublicKeyToken=
31bf3856ad364e35' and 'Microsoft.AspNet.Identity, Version=3.0.0.0, Culture=neutral, PublicKeyToken=n
ull'
G:\apps\pcsc\GreenShelter\src\mvc\Models\ApplicationUser.cs(23,63): error CS0246: The type or namesp
ace name 'UserManager<ApplicationUser>' could not be found (are you missing a using directive or an
assembly reference?)
G:\apps\pcsc\GreenShelter\src\mvc\Models\ApplicationUserManager.cs(7,40): error CS0433: The type 'Us
erManager<TUser>' exists in both 'Microsoft.AspNet.Identity.Core, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35' and 'Microsoft.AspNet.Identity, Version=3.0.0.0, Culture=neutral, P
ublicKeyToken=null'
G:\apps\pcsc\GreenShelter\src\mvc\Models\ApplicationUserManager.cs(11,63): error CS1729: 'UserManage
r<ApplicationUser>' does not contain a constructor that takes 1 arguments
G:\apps\pcsc\GreenShelter\src\mvc\Models\ApplicationUser.cs(26,72): error CS0103: The name 'DefaultA
uthenticationTypes' does not exist in the current context
G:\apps\pcsc\GreenShelter\src\mvc\Models\ApplicationRoleManager.cs(11,63): error CS1729: 'RoleManage
r<ApplicationRole>' does not contain a constructor that takes 1 arguments
   at Microsoft.Framework.Runtime.Roslyn.RoslynProjectReference.Load(IAssemblyLoadContext loadContex
t)
   at Microsoft.Framework.Runtime.Loader.ProjectAssemblyLoader.Load(String name, IAssemblyLoadContex
t loadContext)
   at Microsoft.Framework.Runtime.Loader.ProjectAssemblyLoader.Load(String name)
   at klr.host.LoaderContainer.Load(String name)
   at klr.hosting.RuntimeBootstrapper.<>c__DisplayClass6_0.<ExecuteAsync>b__4(AssemblyName assemblyN
ame)
   at klr.hosting.RuntimeBootstrapper.<>c__DisplayClass6_0.<ExecuteAsync>b__7(Object sender, Resolve
EventArgs a)
   at System.AppDomain.OnAssemblyResolveEvent(RuntimeAssembly assembly, String assemblyFullName)
   at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence asse
mblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boole
an throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assem
blySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolea
n throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence
assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Bo
olean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.Assembly.Load(AssemblyName assemblyRef)
   at Microsoft.AspNet.Hosting.Startup.StartupLoader.LoadStartup(String applicationName, String envi
ronmentName, IList`1 diagnosticMessages)
   at Microsoft.AspNet.Hosting.Startup.StartupManager.LoadStartup(String applicationName, String env
ironmentName)
   at Microsoft.AspNet.Hosting.HostingEngine.EnsureApplicationStartup(HostingContext context)
   at Microsoft.AspNet.Hosting.HostingEngine.EnsureApplicationDelegate(HostingContext context)
   at Microsoft.AspNet.Hosting.HostingEngine.Start(HostingContext context)
   at Microsoft.AspNet.Hosting.Program.Main(String[] args)


Microsoft.Framework.Runtime.Roslyn.RoslynCompilationException: G:\apps\pcsc\GreenShelter\src\mvc\Mod
els\ApplicationRoleManager.cs(7,40): error CS0433: The type 'RoleManager<TRole>' exists in both 'Mic
rosoft.AspNet.Identity.Core, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' and
'Microsoft.AspNet.Identity, Version=3.0.0.0, Culture=neutral, PublicKeyToken=null'
G:\apps\pcsc\GreenShelter\src\mvc\Models\ApplicationUser.cs(23,63): error CS0246: The type or namesp
ace name 'UserManager<ApplicationUser>' could not be found (are you missing a using directive or an
assembly reference?)
G:\apps\pcsc\GreenShelter\src\mvc\Models\ApplicationUserManager.cs(7,40): error CS0433: The type 'Us
erManager<TUser>' exists in both 'Microsoft.AspNet.Identity.Core, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35' and 'Microsoft.AspNet.Identity, Version=3.0.0.0, Culture=neutral, P
ublicKeyToken=null'
G:\apps\pcsc\GreenShelter\src\mvc\Models\ApplicationUserManager.cs(11,63): error CS1729: 'UserManage
r<ApplicationUser>' does not contain a constructor that takes 1 arguments
G:\apps\pcsc\GreenShelter\src\mvc\Models\ApplicationUser.cs(26,72): error CS0103: The name 'DefaultA
uthenticationTypes' does not exist in the current context
G:\apps\pcsc\GreenShelter\src\mvc\Models\ApplicationRoleManager.cs(11,63): error CS1729: 'RoleManage
r<ApplicationRole>' does not contain a constructor that takes 1 arguments
   at Microsoft.Framework.Runtime.Roslyn.RoslynProjectReference.Load(IAssemblyLoadContext loadContex
t)
   at Microsoft.Framework.Runtime.Loader.ProjectAssemblyLoader.Load(String name, IAssemblyLoadContex
t loadContext)
   at Microsoft.Framework.Runtime.Loader.ProjectAssemblyLoader.Load(String name)
   at klr.host.LoaderContainer.Load(String name)
   at klr.hosting.RuntimeBootstrapper.<>c__DisplayClass6_0.<ExecuteAsync>b__4(AssemblyName assemblyN
ame)
   at klr.hosting.RuntimeBootstrapper.<>c__DisplayClass6_0.<ExecuteAsync>b__7(Object sender, Resolve
EventArgs a)
   at System.AppDomain.OnAssemblyResolveEvent(RuntimeAssembly assembly, String assemblyFullName)
PS G:\apps\pcsc\GreenShelter\src\mvc>

Below is my project.json.

{
  "webroot": "wwwroot",
  "version": "1.0.0.0",
  "authors": [
    "Karega Scott - PCSC"
  ],
  "description": "Green Shelter Core Project",
  "compilationOptions": {
    "warningsAsErrors": true
  },
  "exclude": "*.bk",
  "dependencies": {
    "Microsoft.Framework.ConfigurationModel": "1.0.0-*",
    "Microsoft.Framework.ConfigurationModel.Json": "1.0.0-*",
    "Microsoft.Framework.Logging": "1.0.0-*",
    "Microsoft.Framework.Logging.Console": "1.0.0-*",
    "Kestrel": "1.0.0-*",
    "Microsoft.AspNet.Diagnostics": "1.0.0-*",
    "Microsoft.AspNet.Hosting": "1.0.0-*",
    "Microsoft.AspNet.Http": "1.0.0-*",
    "Microsoft.AspNet.Identity": "3.0.0-*",
    "Microsoft.AspNet.Mvc": "6.0.0-*",
    "Microsoft.AspNet.Routing": "1.0.0-*",
    "Microsoft.AspNet.Server.WebListener": "1.0.0-*",
    "Microsoft.AspNet.StaticFiles": "1.0.0-*",
    "Microsoft.AspNet.Security": "1.0.0-*",
    "Microsoft.AspNet.Security.Cookies": "1.0.0-*",
    "Mongodb": "1.7.1.4791",
    "AspNet.Identity.MongoDB": "1.0.11"
  },
  "commands": {
    "web": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.WebListener --server.urls http://localhost:8080",
    "kestrel": "Microsoft.AspNet.Hosting --server Kestrel --server.urls http://localhost:8181"
  },
  "frameworks": {
    "aspnet50": {
      "dependencies": {
        "Microsoft.Framework.Logging.NLog": "1.0.0-*"
      }
    }
  },
  "configurations": {
    "Debug": {
      "compilationOptions": {
        "define": [
          "DEBUG",
          "TRACE"
        ]
      }
    },
    "Release": {
      "compilationOptions": {
        "define": [
          "RELEASE",
          "TRACE"
        ],
        "optimize": true
      }
    }
  }
}
@davidfowl
Copy link
Member

From the error ir looks like AspNet.Identity.MongoDB is pulling in identity 2 and you're also referencing identity 3

@kscott5
Copy link
Author

kscott5 commented Jan 26, 2015

Yeah, your right I just thought Dependency Resolutions "Nearest wins" would take care of this but I simply removed one of the dependencies.

@kscott5 kscott5 closed this as completed Jan 26, 2015
@davidfowl
Copy link
Member

Usually that would work, except that Identity v1 and v2 have different package names:

v2 is Microsoft.AspNet.Identity.Core
v3 is Microsoft.AspNet.Identity

@kscott5
Copy link
Author

kscott5 commented Jan 27, 2015

I enjoy development and I'm great with troubleshooting/hunting downing and fixing issues. So, How/What could I do to contribute in a meaningful way?

ryanbrandenburg pushed a commit that referenced this issue Nov 19, 2018
Update project .gitignore. Closes #280
@ghost ghost locked as resolved and limited conversation to collaborators Dec 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants