Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

Adding PCL reference causes "System.Object is not defined" error

$
0
0

Ive done a ton of searching and tried many solutions, but nothing seems to work.  I have a PCL  with this project.json:

{"supports": {"net46.app": {},"uwp.10.0.app": {},"dnxcore50.app": {}
  },"dependencies": {"Microsoft.NETCore": "5.0.0","Microsoft.NETCore.Portable.Compatibility": "1.0.0","System.ServiceModel.Primitives": "4.0.0"
  },"frameworks": {"dotnet": {"imports": "portable-net452+win81"
    }
  }
}

When I add a reference to my web application, the resulting web app's project.json looks like this:

{"version": "1.0.0-*","compilationOptions": {"emitEntryPoint": true
  },"dependencies": {"Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final","Microsoft.AspNet.Mvc": "6.0.0-rc1-final","Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final","Microsoft.AspNet.StaticFiles": "1.0.0-rc1-final","Microsoft.Extensions.Configuration.FileProviderExtensions" : "1.0.0-rc1-final","Microsoft.Extensions.Configuration.Json": "1.0.0-rc1-final","Microsoft.Extensions.Logging": "1.0.0-rc1-final","Microsoft.Extensions.Logging.Console": "1.0.0-rc1-final","Microsoft.Extensions.Logging.Debug": "1.0.0-rc1-final"
  },"commands": {"web": "Microsoft.AspNet.Server.Kestrel"
  },"frameworks": {"dnx451": {"dependencies": {"MyPcl": "1.0.0-*"
      }
    },"dnxcore50": {"dependencies": {"MyPcl": "1.0.0-*"
      }
    }
  },"exclude": ["wwwroot","node_modules"
  ],"publishExclude": ["**.user","**.vspscc"
  ]
}

Which from what I can tell should be correct, but it results in a couple of errors in the web app:

Predefined type 'System.Object' is not defined or imported	MyWebApp.DNX 4.5.1	C:\source\MyWebAppStartup.cs
Predefined type 'System.Void' is not defined or imported	MyWebApp.DNX 4.5.1	C:\source\MyWebApp\Startup.cs

Ive found 100 ways to fix this, and Im just not getting it.  Any help would be appreciated. (Im using VS2015)

EDIT: Restarting VS resolved those errors. Now there is only this error

Object reference not set to an instance of an object.   MyWebApp    C:\source\MyWebApp\DNX  


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>