[英]Unable to build a console application in ASP.NET 5 dnx
我無法使用Visual Studio Code在Debian上構建以下應用程序。 我錯過了什么?
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");
}
}
}
我在dnu build
上dnu build
這個錯誤:
/home/ab2/projects/ParseAB2Steps/Program.cs(13,31):DNXCore,Version = v5.0錯誤CS0103:當前上下文中不存在名稱“文件”
構建失敗。
注意:我通過復制上一行中的版本手動將System.IO行放在project.json中,並且能夠成功執行dnu restore
。
我也知道新的dotnet
cli並且我沒有升級到它,因為據我所知,Debian沒有直接支持。 所以,我正在使用我目前擁有的dnx
環境。
編輯2:
輸出
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
將依賴從System.IO
更改為System.IO.FileSystem
對我來說是個竅門。
您也可以將System.IO
保留在文件中,但無論如何它都會被引入,因為它是少數其他程序集的依賴項,包括System.Console
和System.IO.FileSystem
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.