如何在Microsoft的新Visual Studio Code中编译c#? [英] How to compile c# in Microsoft's new Visual Studio Code?

查看:204
本文介绍了如何在Microsoft的新Visual Studio Code中编译c#?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经安装了 Microsoft的新代码编辑器 Visual Studio Code 的预览版。看来是个不错的工具!

I have installed the preview version of Microsoft's new code editor "Visual Studio Code". It seems quite a nice tool!

引言中提到您可以使用它编程c#,但是安装文档中没有提到如何实际编译c#文件。

您可以在 launch.json 文件中将 mono定义为一种类型,但这还没有做任何事情。按F5会导致:确保从启动下拉菜单中选择一个配置 ...

You can define "mono" as a type in the "launch.json" file, but that does not do anything yet. Pressing F5 results in: "make sure to select a configuration from the launch dropdown"...

此外,intellisense不支持c#吗?您如何设置任何包含的框架的路径?

Also, intellisense is not working for c#? How do you set the path to any included frameworks?

Launch.json:

"configurations": [
        {
            // Name of configuration; appears in the launch configuration drop down menu.
            "name": "Cars.exe",
            // Type of configuration. Possible values: "node", "mono".
            "type": "mono",
            // Workspace relative or absolute path to the program.
            "program": "cars.exe",
        }, 
        {
            "type": "mono",
        }


推荐答案

Intellisense确实适用于C#6,而且很棒。

Intellisense does work for C# 6, and it's great.

要运行控制台应用程序,您应该设置一些其他工具

For running console apps you should set up some additional tools:


  • ASP.NET 5;在Powershell中:& {$ Branch ='dev'; iex((新对象net.webclient).DownloadString('https://raw.githubusercontent.com/aspnet/Home/dev/dnvminstall .ps1'))}

  • Node.js 包括软件包管理器 npm

  • 其余所需工具,包括Yeoman yo npm install -g yo grunt-cli generator-aspnet bower

  • 您还应该调用.NET版本管理器: c:\Users\用户名\.dnx\bin\dnvm.cmd升级-u

  • ASP.NET 5; in Powershell: &{$Branch='dev';iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/aspnet/Home/dev/dnvminstall.ps1'))}
  • Node.js including package manager npm.
  • The rest of required tools including Yeoman yo: npm install -g yo grunt-cli generator-aspnet bower
  • You should also invoke .NET Version Manager: c:\Users\Username\.dnx\bin\dnvm.cmd upgrade -u

然后您可以使用 yo 作为控制台应用程序的向导: yo aspnet 选择名称和项目类型。之后,转到创建的文件夹 cd ./MyNewConsoleApp / 并运行 dnu restore

Then you can use yo as wizard for Console Application: yo aspnet Choose name and project type. After that go to created folder cd ./MyNewConsoleApp/ and run dnu restore

要执行程序,只需在命令面板中键入> run Ctrl + Shift + P ),或执行 dnx。在项目目录的shell中运行

To execute your program just type >run in Command Palette (Ctrl+Shift+P), or execute dnx . run in shell from the directory of your project.

这篇关于如何在Microsoft的新Visual Studio Code中编译c#?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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