Predefined type 'System.Object' is not defined or imported .net 4.6

后端 未结 12 1230
别那么骄傲
别那么骄傲 2021-02-06 20:02

I\'m using MVC 5 and .net 4.6 to create a web API that my mobile app can connect too.

Whenever I build the project I get hundreds of errors telling me that I need to add

12条回答
  •  囚心锁ツ
    2021-02-06 20:55

    I'm guessing a bit here but it looks suspicious that you are using the regular System.Data.* stuff for dnx451 but doesn't have anything to make up for it for dnxcore50. Are you targeting the core edition as well or is it just leftovers from project creation? If you want to target the core edition and still use the old System.Data.* stuff you'll need to wrap anything from those assemblies like this.

    #if DNX451
    // Do some DNX451 specific stuff here
    #endif
    

    And the other way around as well.

    #if DNXCORE50
    // Do some DNXCORE50 specific stuff here
    #endif
    

    But if you aren't thinking about supporting this yet I would simply remove dnxcore50 from the framework list and your errors will probably go away.

提交回复
热议问题