2
votes

I am migrating from ASP.NET MVC 5 on .NET Framework 4.6 to ASP.NET Core on NetCoreApp1.1.

I'm getting these errors:

The type 'Enum' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'

The type 'DateTime' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'

I guess all kind of this error derived from assembly incompatible, anybody know how to fix this issue?

I did add the package Microsoft.NETCore.Portable.Compatibility but no help.

1
Those base types should be included in Microsoft.NETCore.App. Are you referencing that package? Can you post your project definition?Nate Barbettini
@DavidG This is a .Net core app, it can't reference mscorelibVMAtm

1 Answers

0
votes

I was able to figure out. It was my mistake. When I created new project I chose "ASP.NET .NET Core" Template. It should be "ASP.NET .NET Framework". I don't know what is the different between two template, but the 3rd one in the pic below will support compatibility with net fw 4.x if you want to add ref to legacy project.

See Pic Below