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”: { }

Español:

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: https://social.msdn.microsoft.com/Forums/sqlserver/en-US/98dbf3ca-3efd-4649-85f6-6d6af852f6de/error-cs0103-the-name-file-does-not-exist-in-the-current-context?forum=csharpgeneral&prof=required

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s