简体   繁体   English

如何在Ubuntu中的Visual Studio代码中运行C#程序

[英]how to run c# program in visual studio code in ubuntu

I've got a problem with Visual Studio Code in Ubuntu 15.04. 我在Ubuntu 15.04中遇到了Visual Studio Code的问题。 When I try to run c# program in Visual Studio Code I get an error "OmniSharp server is not running". 当我尝试在Visual Studio Code中运行c#程序时,出现错误“ OmniSharp服务器未运行”。 How to fix that? 如何解决? I try to run a program by ctrl+shift+p through dnx: Run Command, but I can't. 我尝试通过dnx通过ctrl + shift + p运行程序:运行命令,但我不能。 Maybe do I need install something for that? 也许我需要为此安装一些东西吗?

The answer to your problem might be in the OmniSharpServer git page ( https://github.com/nosami/OmniSharpServer ). 您的问题的答案可能在OmniSharpServer git页面( https://github.com/nosami/OmniSharpServer )中。 You have mono on your system, so you have to clone the OmniSharpServerRepository and execute this lines in a shell: 您的系统上有单声道,因此必须克隆OmniSharpServerRepository并在shell中执行以下行:

git clone https://github.com/nosami/OmniSharpServer.git cd OmniSharpServer git submodule update --init --recursive xbuild If xbuild complained about some assemblies missing something is wrong with the git submodule update --init --recursive. git clone https://github.com/nosami/OmniSharpServer.git cd OmniSharpServer git子模块更新--init --recursive xbuild如果xbuild抱怨某些程序集丢失了git子模块更新--init --recursive出了问题。 As long as you get the "N Error(s)" message at the bottom you wont find any binary (exe or dll) in the project. 只要您在底部获得“ N Error(s)”消息,您就不会在项目中找到任何二进制文件(exe或dll)。 If you solve the errors the binaries should be at "OmniSharpServer/OmniSharp/bin/Debug". 如果您解决了错误,则二进制文件应位于“ OmniSharpServer / OmniSharp / bin / Debug”处。

A detailed error log would help or a bit more info. 详细的错误日志会有所帮助或提供更多信息。

I downloaded VSCode + the C# Extension and then installed the .NET SDK from Microsoft's website: https://www.microsoft.com/net/learn/get-started/linuxubuntu 我下载了VSCode + C#Extension,然后从Microsoft网站安装了.NET SDK: https//www.microsoft.com/net/learn/get-started/linuxubuntu

After I ran my first C# Application I got the prompt listed below on VSCode's Terminal and it worked like a charm! 运行我的第一个C#应用程序后,我在VSCode的终端上得到了下面列出的提示,它像个魅力一样起作用! Hope it helps. 希望能帮助到你。

Updating C# dependencies... Platform: linux, x86_64, name=ubuntu, version=16.04 正在更新C#依赖项...平台:linux,x86_64,name = ubuntu,version = 16.04

Downloading package 'OmniSharp for Linux (x64)' (23531 KB) .................... Done! 正在下载软件包“ OmniSharp for Linux(x64)”(23531 KB)....................完成! Downloading package '.NET Core Debugger (linux / x64)' (54878 KB) .................... Done! 正在下载软件包“ .NET Core Debugger(linux / x64)”(54878 KB)....................完成!

Installing package 'OmniSharp for Linux (x64)' Installing package '.NET Core Debugger (linux / x64)' 安装软件包“ OmniSharp for Linux(x64)”安装软件包“ .NET Core Debugger(linux / x64)”

Finished 已完成

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM