gpt4 book ai didi

c# - 在 Linux 上运行 .NET Core——什么都不写

转载 作者:IT王子 更新时间:2023-10-29 00:44:19 25 4
gpt4 key购买 nike

我在 Visual Studio 中创建了项目 vNext 控制台应用程序。我将这些文件复制到 linux 机器上。并尝试运行它们

ubuntu@ubuntu-Virtual-Machine:~/ConsoleApp2/src/ConsoleApp2$ dnvm list

Active Version Runtime Architecture OperatingSystem Alias
------ ------- ------- ------------ --------------- -----
* 1.0.0-rc1-final coreclr x64 linux
1.0.0-rc1-final mono linux/osx default

ubuntu@ubuntu-Virtual-Machine:~/ConsoleApp2/src/ConsoleApp2$ dnu restore
ubuntu@ubuntu-Virtual-Machine:~/ConsoleApp2/src/ConsoleApp2$ dnx run
ubuntu@ubuntu-Virtual-Machine:~/ConsoleApp2/src/ConsoleApp2$

我的应用程序没有运行。但是,如果我将 dnvm 切换为单声道,它就可以正常工作。我的文件内容是

Program.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace ConsoleApp2
{
public class Program
{
public void Main(string[] args)
{
Console.WriteLine("Hello world!!!!");
Console.Read();
}
}
}

project.json

{
"version": "1.0.0-*",
"description": "ConsoleApp2 Console Application",
"authors": [ "Anton" ],
"tags": [ "" ],
"projectUrl": "",
"licenseUrl": "",

"dependencies": {

},

"frameworks": {
"dnx451": {},
"dnxcore50": {
"dependencies": {

"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"
}
}
}
}

为什么当切换到 coreclr 时 dnx 命令不写入任何内容?

最佳答案

大体上确定您缺少一个先决条件。它们被列为 here :

sudo apt-get install libunwind8 gettext libssl-dev libcurl4-openssl-dev zlib1g libicu-dev uuid-dev

关于c# - 在 Linux 上运行 .NET Core——什么都不写,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34015170/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com