.NET 5 DNX The type or namespace name 'List' could not be found (are you missing a using directive or an assembly reference?)

When playing around with the new  .NET 5 DNX solution I encountered the following error:

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

I don’t understand exactly what was causing the error. I think the problem is that my project.json file was not configured correctly. I think that the dnxcore05 didn’t know about system.collections and just adding it to the dependencies didn’t work. Instead I had to add it to the dependencies under the frameworks section of the config like so:

{
	"version": "1.0.0-*",
	"description": "Sample Class Library",
	"authors": [ "GerardBeckerleg" ],
	"tags": [ "" ],
	"projectUrl": "",
	"licenseUrl": "",

	"dependencies": {
	},

	"frameworks": {
		"dnx451": {
			"frameworkAssemblies": {
			},
			"dependencies": {
			}
		},
		"dnxcore50": {
			"frameworkAssemblies": {
			},
			"dependencies": {
				"System.Runtime": "4.0.21-beta*",
				"System.Collections": "4.0.10-beta*"
			}
		}
	}
}
comments powered by Disqus