外贸建站 智能营销,什么网站可以做论文,WordPress Demo演示,帝国cms收费吗vscode是一款跨平台、轻量级、开源的IDE, 支持C、C、Java、C#、R、Python、Go、Nodejs等多种语言的开发和调试。下面介绍在vscode里配置C#环境。这里以配置.Net SDK v5.0#xff0c;语言版本为C#9.0#xff0c;对应的开发平台为VS2019#xff0c;作为案例说明。
1、下载vsc… vscode是一款跨平台、轻量级、开源的IDE, 支持C、C、Java、C#、R、Python、Go、Nodejs等多种语言的开发和调试。下面介绍在vscode里配置C#环境。这里以配置.Net SDK v5.0语言版本为C#9.0对应的开发平台为VS2019作为案例说明。
1、下载vscode vscode每3个月就有一次版本更新而且分为Linux、Mac、Window这个平台版本这里只介绍Window平台版本的下载。 vscode官网: https://code.visualstudio.com/download 图(1) 下载vscode 下载vscode后双击该安装包一路默认直到安装完成。
2、下载.Net SDK v5.0 C#语言从2002年2月开始发布的最初版本是v1.0接着2003年是C# 1.12005年是C# 2.02007年是C# 3.0, 2010年是C# 4.0, 2012年是C# 5.0,…到2022年C#的版本发展到了v11, C#的更新换代非常快如下表所示
IDEC#版本.Net Framework版本.Net Core版本特性Visual Studio 2002C# 1.0.NET Framework 1.0无委托和事件Visual Studio 2003C# 1.1.NET Framework 1.2无APM(异步编程模型)Visual Studio 2005C# 2.0.NET Framework 2.0无泛型、匿名方法、迭代器、可空类型Visual Studio 2008C# 3.0.NET Framework 3.0无隐式类型Visual Studio 2008C# 3.0.NET Framework 3.5无lambda表达式,自动实现属性,对象集合初始化,匿名方法,扩展方法,LINQVisual Studio 2010C# 4.0.NET Framework 4.0无动态绑定,命名和可选参数,泛型的协变和逆变Visual Studio 2012C# 5.0.NET Framework 4.5无异步和等待,调用方信息Visual Studio 2013C# 5.0.NET Framework 4.5无异步和等待,调用方信息Visual Studio 2015C# 6.0.NET Framework 4.6.Net Core 1.0C#静态导入,异常筛选器,Null传播器,nameof预算符Visual Studio 2017C# 7.0/7.1/7.2/7.3.NET Framework 4.6.2/4.7/4.7.1/4.7.2.Net Core 2.0/2.1/2.2C#模式匹配,元组和析构函数,ref局部变量Visual Studio 2019C# 8.0.NET Framework 4.8.Net Core 3.0/3.1C#异步流,ReadOnly成员,非托管构造类型Visual Studio 2019C# 9.0.NET Framework 4.8.Net Core 5.0C#函数指针,static匿名函数,协变返回类型Visual Studio 2022C# 10.0.NET Framework 4.8.Net Core 6.0C#扩展属性模式,记录结构,密封ToString()Visual Studio 2022C# 11.NET Framework 4.8.Net Core 6.0C# UTF-8支持,列表模式,数值IntPtr 本文由于要与Visual Studio 2019配套所以下载.Net SDK v5.0版本地址为 https://dotnet.microsoft.com/zh-cn/download/dotnet右击.Net 5.0在新页面里找到SDK 5.0.214版本选择 Windows X64版本下载即可如图(2)、图(3)所示 图(2) 选择.Net 5.0版本 图(3) 选择 Windows X64版本进行下载 3、安装插件 打开vscode软件点击vscode左侧的田字图标安装三个插件code runner、.Net Install Tool for Extension Authors、C#, 分别如图(4)、图(5)、图(6)所示 图(4) 安装Code Runner插件 图(5) 安装.Net Install Tool for Extensioni Authors插件 图(6) 安装C#插件 4、配置插件 设置Code Runner插件里的.cs文件的编译方式点击vscode左侧的田字图标 --》 输入: runner --》找到Code Runner --》右击齿轮图标 --》扩展设置 --》找到 executor Map --》在settings.json中编辑如图(7)、图(8)所示 图(7) 点击田字 --》输入: runner ---》找到Code Runner 图(8) 找到 Executor Map Code Runner插件的的settings.json 的全部配置如下
{workbench.colorTheme: One Dark Modern,go.gopath: D:\\Ide\\GoProject,go.goroot: D:\\Ide\\Go,code-runner.languageIdToFileExtensionMap: {bat: .bat,powershell: .ps1,typescript: .ts},code-runner.executorMap: { javascript: node,java: cd $dir javac $fileName java $fileNameWithoutExt,c: cd $dir gcc $fileName -o $fileNameWithoutExt $dir$fileNameWithoutExt,zig: zig run,cpp: cd $dir g -stdc11 $fileName -o $fileNameWithoutExt $dir$fileNameWithoutExt,objective-c: cd $dir gcc -framework Cocoa $fileName -o $fileNameWithoutExt $dir$fileNameWithoutExt,php: php,python: python -u,perl: perl,perl6: perl6,ruby: ruby,go: go run,lua: lua,groovy: groovy,powershell: powershell -ExecutionPolicy ByPass -File,bat: cmd /c,shellscript: bash,fsharp: fsi,csharp: cd $dir dotnet run,vbscript: cscript //Nologo,typescript: ts-node,coffeescript: coffee,scala: scala,swift: swift,julia: julia,crystal: crystal,ocaml: ocaml,r: Rscript,applescript: osascript,clojure: lein exec,haxe: haxe --cwd $dirWithoutTrailingSlash --run $fileNameWithoutExt,rust: cd $dir rustc $fileName $dir$fileNameWithoutExt,racket: racket,scheme: csi -script,ahk: autohotkey,autoit: autoit3,dart: dart,pascal: cd $dir fpc $fileName $dir$fileNameWithoutExt,d: cd $dir dmd $fileName $dir$fileNameWithoutExt,haskell: runghc,nim: nim compile --verbosity:0 --hints:off --run,lisp: sbcl --script,kit: kitc --run,v: v run,sass: sass --style expanded,scss: scss --style expanded,less: cd $dir lessc $fileName $fileNameWithoutExt.css,FortranFreeForm: cd $dir gfortran $fileName -o $fileNameWithoutExt $dir$fileNameWithoutExt,fortran-modern: cd $dir gfortran $fileName -o $fileNameWithoutExt $dir$fileNameWithoutExt,fortran_fixed-form: cd $dir gfortran $fileName -o $fileNameWithoutExt $dir$fileNameWithoutExt,fortran: cd $dir gfortran $fileName -o $fileNameWithoutExt $dir$fileNameWithoutExt,sml: cd $dir sml $fileName},C_Cpp.default.intelliSenseMode: windows-gcc-x64,workbench.editor.languageDetectionHints: {notebookEditors: false},C_Cpp.default.compilerArgs: [-stdc11],C_Cpp.default.compilerPath: ,code-runner.executorMapByGlob: {pom.xml: cd $dir mvn clean package}
}C# 全称为c sharp则在settings.json里的配置如下
code-runner.executorMap: { csharp: cd $dir dotnet run,
},5、创建工程HelloCsharp 打开vscode软件点击vscode菜单栏里的【终端】–》新建终端 --》输入: cmd切换到cmd模式 --》创建一个C#控制台工程: HelloCsharp的命令为
dotnet new console -n HelloCsharp进入HelloCsharp工程目录
cd HelloCsharp编译C#工程并运行.cs文件
dotnet run如图(9)所示 图(9)创建C#程序并编译运行 参考文献
[1] C#语言版本发展历史.microsoft.learn [2].Net版本发展历史.microsoft.learn [3] C#历史简介.wikepedia 文章转载自: http://www.morning.khxwp.cn.gov.cn.khxwp.cn http://www.morning.pltbd.cn.gov.cn.pltbd.cn http://www.morning.pndhh.cn.gov.cn.pndhh.cn http://www.morning.dmwbs.cn.gov.cn.dmwbs.cn http://www.morning.qsmdd.cn.gov.cn.qsmdd.cn http://www.morning.cfcdr.cn.gov.cn.cfcdr.cn http://www.morning.zmpsl.cn.gov.cn.zmpsl.cn http://www.morning.lydtr.cn.gov.cn.lydtr.cn http://www.morning.nnrqg.cn.gov.cn.nnrqg.cn http://www.morning.hpmzs.cn.gov.cn.hpmzs.cn http://www.morning.mnsts.cn.gov.cn.mnsts.cn http://www.morning.yrhd.cn.gov.cn.yrhd.cn http://www.morning.nmhpq.cn.gov.cn.nmhpq.cn http://www.morning.lrprj.cn.gov.cn.lrprj.cn http://www.morning.gypcr.cn.gov.cn.gypcr.cn http://www.morning.qqklk.cn.gov.cn.qqklk.cn http://www.morning.wqpsf.cn.gov.cn.wqpsf.cn http://www.morning.lkpzx.cn.gov.cn.lkpzx.cn http://www.morning.qjfkz.cn.gov.cn.qjfkz.cn http://www.morning.dnqpq.cn.gov.cn.dnqpq.cn http://www.morning.wztlr.cn.gov.cn.wztlr.cn http://www.morning.rfxyk.cn.gov.cn.rfxyk.cn http://www.morning.xhkgl.cn.gov.cn.xhkgl.cn http://www.morning.bzfld.cn.gov.cn.bzfld.cn http://www.morning.gwxwl.cn.gov.cn.gwxwl.cn http://www.morning.glrzr.cn.gov.cn.glrzr.cn http://www.morning.sloxdub.cn.gov.cn.sloxdub.cn http://www.morning.fkgcd.cn.gov.cn.fkgcd.cn http://www.morning.xjtnp.cn.gov.cn.xjtnp.cn http://www.morning.fsqbx.cn.gov.cn.fsqbx.cn http://www.morning.nrmyj.cn.gov.cn.nrmyj.cn http://www.morning.zcwzl.cn.gov.cn.zcwzl.cn http://www.morning.dpflt.cn.gov.cn.dpflt.cn http://www.morning.xhgcr.cn.gov.cn.xhgcr.cn http://www.morning.jkbqs.cn.gov.cn.jkbqs.cn http://www.morning.flzqq.cn.gov.cn.flzqq.cn http://www.morning.rkhhl.cn.gov.cn.rkhhl.cn http://www.morning.kkhf.cn.gov.cn.kkhf.cn http://www.morning.fdmfn.cn.gov.cn.fdmfn.cn http://www.morning.bpmnq.cn.gov.cn.bpmnq.cn http://www.morning.kzqpn.cn.gov.cn.kzqpn.cn http://www.morning.hhpkb.cn.gov.cn.hhpkb.cn http://www.morning.lbhck.cn.gov.cn.lbhck.cn http://www.morning.qrmyd.cn.gov.cn.qrmyd.cn http://www.morning.lbcfj.cn.gov.cn.lbcfj.cn http://www.morning.ejknty.cn.gov.cn.ejknty.cn http://www.morning.qlck.cn.gov.cn.qlck.cn http://www.morning.dwwbt.cn.gov.cn.dwwbt.cn http://www.morning.xqltq.cn.gov.cn.xqltq.cn http://www.morning.yrdt.cn.gov.cn.yrdt.cn http://www.morning.hxxzp.cn.gov.cn.hxxzp.cn http://www.morning.yrbq.cn.gov.cn.yrbq.cn http://www.morning.hrgxk.cn.gov.cn.hrgxk.cn http://www.morning.qichetc.com.gov.cn.qichetc.com http://www.morning.dsprl.cn.gov.cn.dsprl.cn http://www.morning.skksz.cn.gov.cn.skksz.cn http://www.morning.xkmrr.cn.gov.cn.xkmrr.cn http://www.morning.jlqn.cn.gov.cn.jlqn.cn http://www.morning.gfrjs.cn.gov.cn.gfrjs.cn http://www.morning.dpmkn.cn.gov.cn.dpmkn.cn http://www.morning.rzysq.cn.gov.cn.rzysq.cn http://www.morning.gqbtw.cn.gov.cn.gqbtw.cn http://www.morning.gjsjt.cn.gov.cn.gjsjt.cn http://www.morning.lhrxq.cn.gov.cn.lhrxq.cn http://www.morning.bmmyx.cn.gov.cn.bmmyx.cn http://www.morning.snbq.cn.gov.cn.snbq.cn http://www.morning.jzsgn.cn.gov.cn.jzsgn.cn http://www.morning.sqfrg.cn.gov.cn.sqfrg.cn http://www.morning.kcnjz.cn.gov.cn.kcnjz.cn http://www.morning.lsjgh.cn.gov.cn.lsjgh.cn http://www.morning.fjlsfs.com.gov.cn.fjlsfs.com http://www.morning.lpcct.cn.gov.cn.lpcct.cn http://www.morning.jwmws.cn.gov.cn.jwmws.cn http://www.morning.mingjiangds.com.gov.cn.mingjiangds.com http://www.morning.lsnhs.cn.gov.cn.lsnhs.cn http://www.morning.fsbns.cn.gov.cn.fsbns.cn http://www.morning.rqjxc.cn.gov.cn.rqjxc.cn http://www.morning.dysgr.cn.gov.cn.dysgr.cn http://www.morning.pigcamp.com.gov.cn.pigcamp.com http://www.morning.trnhy.cn.gov.cn.trnhy.cn