微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

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

为什么dnx命令在切换到coreclr时什么都不写?

解决方法

绝对肯定你错过了其中一个先决条件.它们被列为 here

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

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐