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

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

问题描述

我已经安装了微软新代码编辑器Visual Studio Code"的预览版.这似乎是一个不错的工具!

介绍中提到可以用它编程c#,但是安装文档没有提到如何实际编译c#文件.

您可以在launch.json"文件中将mono"定义为一种类型,但这还没有任何作用.按 F5 结果:确保从启动下拉列表中选择配置"...

此外,intellisense 不适用于 c#?您如何设置任何包含框架的路径?

Launch.json:

配置":[{//配置名称;出现在启动配置下拉菜单中."name": "Cars.exe",//配置类型.可能的值:节点"、单声道".类型":单声道",//程序的工作区相对或绝对路径."program": "cars.exe",},{类型":单声道",}

解决方案

Intellisense 确实适用于 C# 6,而且非常棒.

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

  • ASP.NET 5;在 Powershell 中:&{$Branch='dev';iex ((new-object 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:UsersUsername.dnxindnvm.cmd upgrade -u

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

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

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

The introduction mentions you can program c# with it, but the setup document does not mention how to actually compile c# files.

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

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 does work for C# 6, and it's great.

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

  • 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:UsersUsername.dnxindnvm.cmd upgrade -u

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

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.

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

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