Category Archives: Code

The name ‘File’ does not exist in the current context[dnxcore50]

Trying to compile a project in Code for Mac using the function File.ReadAllLines was generating the error “The name ‘File’ does not exist in the current context[dnxcore50]”

Code: ReadAllLines
Code: Reading a file from directory tree

After a deep search using google I found the following solution:

Edit the project.json file and remove the following from frameworks:

“dnxcore50”: {
“dependencies”: {
“System.Collections”: “4.0.10-beta-23019”,
“System.Console”: “4.0.0-beta-23019”,
“System.Linq”: “4.0.0-beta-23019”,
“System.Threading”: “4.0.10-beta-23019”,
“Microsoft.CSharp”: “4.0.0-beta-23019”

and just left the following:

“dnx451”: { }


Tratando de compilar un proyecto en Code para Mac al usar File.ReadAllLines me estaba generando el error referido, la solución es la que aparece a continuación, eliminar todo “dnxcore50” del archivo project.json



Extracted from: