编译C#项目在Ubuntu VSCode [英] Compiling C# projects with VSCode on Ubuntu

查看:1662
本文介绍了编译C#项目在Ubuntu VSCode的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我按在文档提供的各种教程设置VSCode在Ubuntu 14.04 - 我想尽可能多的,因为我可以做感。编辑运行没有问题,(通过单声道版本不符加工后)提供了比大多数在我看来,替代品的卓越编码体验。



努力时,我的问题来编译我的C#项目。这是完成入门指南的时候我本来期望的功能。击中后<大骨节病> CTRL + <大骨节病>移动 + <大骨节病>乙我最初提示创建一个 tasks.json 文件看起来提供shortkey行动项目的具体配置。从注释中最初的 tasks.json 生成的,这似乎是针对Windows和指 tsc.exe 程序这是一个打字稿编译器。



我已经度过了MonoDevelop的一点点时间建设项目在同一个笔记本电脑,但从来没有设置编译步骤。我是在错误的假设,这应该是功能提供开箱即用的,或者有我错过了妥善处理C#项目的一个步骤?


解决方案

我要翻翻默认 tasks.json 文件昨晚,当已经不耐烦了。还有就是指的MSBuild(朝下方)一节:



<预类=郎JSON prettyprint-覆盖> //取消对部分下面使用的MSBuild和产生的问题
//为中信建投,CPP,TSC和VB。该配置假定的MSBuild
//可用的路径和解决方案文件在
//工作区文件夹根存在。
/ *
{
版本:0.1.0,
命令:的MSBuild,
ARGS:[
//问的MSBuild生成的文件名的完整路径。
/属性:GenerateFullPaths =真正的
],
taskSelector:/ T,
showOutput:沉默,
任务:
{
TASKNAME:建,
//显示只有当出现无法识别的错误输出窗口。
showOutput:无声,
//使用标准的MS的编译器图案来检测在输出错误,警告
//和相关信息。
problemMatcher:$ msCompile
}
]
}
* /

只是注释掉文件的其余部分,取消上述JSON文本,并从的MSBuild改变命令,以xbuild(单声道当量)。现在按<大骨节病> CTRL + <大骨节病>移动 + <大骨节病>乙成功编译该项目。



希望,使用配置文件本手册的修修补补将不太必要或繁琐,一旦它出来预览。



修改



标记此作为答案现在。将更新或接受一个更好的答案了产品的进化过程中应该改变的东西。


I set up VSCode on Ubuntu 14.04 according to the various tutorials available in the documentation - I tried as many as I could make sense of. The editor runs without issue and (after working through Mono version discrepancies) provides a superior coding experience as compared to most of the alternatives in my opinion.

My issue comes when trying to compile my C# project. This is functionality that I would have expected when completing the Getting Started guide. After hitting ctrl + shift + B I'm initially prompted to create a tasks.json file which looks to provide project specific configuration of shortkey actions. From comments in the initial tasks.json generated, it appears to be targeting Windows and refers to a tsc.exe program which is a TypeScript compiler.

I've spent a little time building projects with MonoDevelop on the same laptop but never had to setup the compilation step. Am I wrong in assuming this should be functionality available out of the box, or have I missed a step for properly handling C# projects?

解决方案

I must have been impatient when looking through the default tasks.json file last night. There is a section that refers to msbuild (towards the bottom):

// Uncomment the section below to use msbuild and generate problems 
// for csc, cpp, tsc and vb. The configuration assumes that msbuild 
// is available on the path and a solution file exists in the  
// workspace folder root. 
/* 
{   
    "version": "0.1.0",
    "command": "msbuild",
    "args": [
        // Ask msbuild to generate full paths for file names.       
        "/property:GenerateFullPaths=true"  
    ],
    "taskSelector": "/t:",
    "showOutput": "silent",
    "tasks": [
        {
            "taskName": "build",
            // Show the output window only if unrecognized errors occur.            
            "showOutput": "silent",
            // Use the standard MS compiler pattern to detect errors, warnings          
            // and infos in the output.
            "problemMatcher": "$msCompile"
        }   
     ] 
 }
*/

Just comment out the rest of the file, uncomment the above JSON text, and change "command" from "msbuild" to "xbuild" (the Mono equivalent). Now hitting ctrl+shift+B successfully compiles the project.

Hopefully, this manual tinkering with configuration files will be less necessary or tedious once it comes out of preview.

EDIT

Marking this as answer for now. Will update or accept a better answer should things change during the evolution of the product.

这篇关于编译C#项目在Ubuntu VSCode的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆