I am unable to build the following application on Debian with Visual Studio Code. What am I missing?
project.json
{
"version": "1.0.0-*",
"description": "ParseAB2Steps Console Application",
"authors": [ "" ],
"tags": [ "" ],
"projectUrl": "",
"licenseUrl": "",
"tooling": {
"defaultNamespace": "ParseAB2Steps"
},
"dependencies": {
},
"commands": {
"ParseAB2Steps": "ParseAB2Steps"
},
"frameworks": {
"dnx451": { },
"dnxcore50": {
"dependencies": {
"Microsoft.CSharp": "4.0.1-beta-23516",
"System.Collections": "4.0.11-beta-23516",
"System.Console": "4.0.0-beta-23516",
"System.Linq": "4.0.1-beta-23516",
"System.Threading": "4.0.11-beta-23516",
"System.IO": "4.0.11-beta-23516"
}
}
}
}
Program.cs
using System;
using System.IO;
namespace ParseAB2Steps
{
public class Program
{
public static void Main(string[] args)
{
Console.WriteLine("Press enter to read ab2steps.md");
Console.Read();
string ab2steps = File.ReadAllText("/home/ab2/Dropbox/nodes/ab2/ab2-steps.md");
}
}
}
I get this error on dnu build
:
/home/ab2/projects/ParseAB2Steps/Program.cs(13,31): DNXCore,Version=v5.0 error CS0103: The name 'File' does not exist in the current context
Build failed.
Note: I put the System.IO line in the project.json manually by copying the version from the previous line and was able to do the dnu restore
successfully.
I am also aware of the new dotnet
cli and I did not upgrade to it as Debian is not directly supported as far as I know. So, I am using the dnx
environment which I currently have.
Edit 2:
Output of
dnvm list
Active Version Runtime Architecture OperatingSystem Alias
------ ------- ------- ------------ --------------- -----
1.0.0-rc1-update1 coreclr x64 linux
* 1.0.0-rc1-update1 mono linux/osx default
1.0.0-rc2-16312 mono linux/osx
Changing the dependency from System.IO
to System.IO.FileSystem
did the trick for me.
You can leave System.IO
in the file as well, but it's brought in anyway since it's a dependency of a few of the other assemblies, including System.Console
and System.IO.FileSystem
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.