VSCode - 添加 C# 程序集引用

VSCode - adding c# assembly reference

出现以下错误:

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


试图构建它,以防它仅与 VSCode 相关。它给了我同样的错误。 我使用以下命令安装了依赖项:

dnu install System.IO

给我以下信息

c:\Users\user1\Dropbox\dev\csharp\vscode\ads\WeightedGraphs>dnu install System.IO GET https://www.nuget.org/api/v2/FindPackagesById()?Id='System.IO'. OK https://www.nuget.org/api/v2/FindPackagesById()?Id='System.IO' 679ms System.IO.4.0.10-beta-22816 was added to project.json. Restoring packages for c:\Users\user1\Dropbox\dev\csharp\vscode\ads\WeightedGraphs\project.json Writing lock file c:\Users\user1\Dropbox\dev\csharp\vscode\ads\WeightedGraphs\project.lock.json Restore complete, 302ms elapsed

project.json

{
    "version": "1.0.0-*",
    "dependencies": {
        "System.IO": "4.0.10-beta-22816"
    },
    "commands": {
        "run": "run"
    },
    "frameworks": {
        "dnx451": {},
        "dnxcore50": {
            "dependencies": {
                "System.Collections": "4.0.10-beta-22816",
                "System.Linq": "4.0.0-beta-22816",
                "System.Console": "4.0.0-beta-22816"
            }
        }
    }
}


In.cs

using System.IO;
public class In{
    public In(string s){
        var filename = s;
        var path = "";
        if(File.Exists(path)){  
            //Code TO Be Added
        }
    }
}

您还需要将 "System.IO.FileSystem" 添加到您的依赖项中。