-
Notifications
You must be signed in to change notification settings - Fork 225
Problem with compiling ASP.NET 5 project beta 6 with dnx451 section Error: Predefined type 'System.Object' is not defined or imported #2422
Comments
I'm guessing the problems have to do with your project references. What are in those projects? |
My ASP.NET 5 project is referencing 3 smaller .NET Core class library projects: Project1.Data which needs to be referenced also from .NET Framework Project so it has dotnet section:
Project1.Model
And Mandrill.Client which also need to be used from .NET Framework project
|
Avoid using the System.* packages in places where dnx451 exist and instead should prefer frameworkAssemblies. Use them in dotnet and in dnxcore50 but not in dnx4x targets. You should also introduce dnx45x targets if you don't have them in your class lib (Project1.Data as an example). |
I had dnx45x targets in Project1.Data but removed them because compilation errors received above.
Can you please give me the example how to refactor only Project1.Data project.json? |
"dependencies": {
"Project1.Model": "1.0.0-*",
"Microsoft.Framework.Configuration.Abstractions": "1.0.0-beta6",
"Microsoft.Framework.Configuration.Json": "1.0.0-beta6",
"Newtonsoft.Json": "7.0.1-beta3"
},
"frameworks": {
"dnx451": {
"frameworkAssemblies": {
"System.Net.Http": "",
"System.Runtime": ""
}
},
"dotnet": {
"dependencies": {
"System.Collections": "4.0.10-beta-23109",
"System.Runtime": "4.0.20-beta-23109",
"System.Runtime.Extensions": "4.0.10-beta-23109",
"System.Net.Http": "4.0.0-beta-23109",
"System.Data.SqlClient": "4.0.0-beta-23109",
"System.Data.Common": "4.0.0-beta-23109"
}
}
} |
I will try this and post update later. I don't understand why I don't need dnxcore50 section? Does this mean that my project will not support .NET Core? |
Managed to make it work.
And in Project1.Data used your project.json just added "System.Data": "" in dnx451 section. |
When I want to compile my project I am getting over 2000 errors like this:
Predefined type 'System.Object' is not defined or imported
If I remove dnx451 section from my project.json config all issues are resolved.
My project.json:
The text was updated successfully, but these errors were encountered: