Skip to content
This repository has been archived by the owner on Dec 18, 2017. It is now read-only.

Build error : The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Runtime, Version=4.0.0.0 #2334

Closed
radenkozec opened this issue Jul 24, 2015 · 7 comments

Comments

@radenkozec
Copy link

I am getting this error: The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Runtime, Version=4.0.0.0
when I try to build .NET Core Class Library Project.

My project.json:

"dependencies": {
"Heu.Model": "1.0.0-*",
"Microsoft.Framework.Configuration.Abstractions": "1.0.0-beta5",
"Microsoft.Framework.Configuration.Json": "1.0.0-beta5",
"System.Net.Http": "4.0.0-beta-23019",
"System.Data.Common": "4.0.0-beta-23019",
"System.Data.SqlClient": "4.0.0-beta-23019",
"Newtonsoft.Json": "7.0.1-beta3"
},

"frameworks": {
"dotnet": {

},
"dnx451": {

},
"dnxcore50": {
  "dependencies": {
    "System.Collections": "4.0.10-beta-23019",
    "System.Runtime": "4.0.20-beta-23019",
    "System.Runtime.Extensions": "4.0.10-beta-23019"
   }
 }

I am also referencing another .NET Core Class Library Project Heu.Model as you can see from project.json.
Any tips how to resolve this problem?

@davidfowl
Copy link
Member

Under dnx451 add:

"frameworkAssemblies": {
    "System.Runtime": ""
}

@radenkozec
Copy link
Author

@davidfowl Thanks. It seams that helps but now I am receiving another issue:

The type 'DBNull' exists in both 'System.Data.Common, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' and 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'

I have tried to move "System.Data.Common": "4.0.0-beta-23019" to dnxcore50 with no success...

@davidfowl
Copy link
Member

Move these all to dnxcore50:

"System.Net.Http": "4.0.0-beta-23019",
"System.Data.Common": "4.0.0-beta-23019",
"System.Data.SqlClient": "4.0.0-beta-23019",

and remove dotnet

@radenkozec
Copy link
Author

@davidfowl I cannot remove dotnet because I need to consume this class library from both classic .net framework project and ASP.NET 5 project.
Even If I remove dotnet section and move these all to dnxcore50 I am getting exception:

The type or namespace name 'SqlParameter' could not be found (are you missing a using directive or an assembly reference?)

I am working with ASP.NET 5 from CTP6 and always have problems with resolving these kind of issues.

@radenkozec
Copy link
Author

@davidfowl Managed to fix issue by removing entire section : "dnx451" from project.json.
Similar issues happens after upgrading to Beta6.
I am getting lot of errors like this: Predefined type 'System.Object' is not defined or imported
Tried add Under dnx451 :

 "frameworkAssemblies": {
    "System.Runtime": ""
}

no help.
After I remove entire section "dnx451" all error are fixed.
Any tips about this?

@davidfowl
Copy link
Member

I don't know what state your project is in at this point.

@radenkozec
Copy link
Author

I will close this issue and open a new related to this issue. I was thinking this is a known issue because 2 other of my colleges told me they resolved their errors also by removing dnx451 section.
@davidfowl I opened a new issue #2422

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