4 ms·
C# has had a command line compiler since... forever. Is the big news just --native mode?
by recursive 11y ago
C# has had a command line compiler since... forever. Is the big news just --native mode?
- enricosada 11y agothe --native already exists, it's not a dotnet cli thing dotnet is a wrapper ( like git command ) for multiple executable, to replace msbuild as project file + build tool and add some new functionalities ( restore nuget packages, etc ) i think the real news is having a dumb project.json (nuget deps,source files,etc) and a xplat tool ( dotnet ) who read this project.json, and can restore packages, compile ( --native too ), publish, packages as another nuget package, etc. All that xplat and multiple language. c# works, F# got merged last week, other coming next. Some example commands: - `dotnet new` scaffold a new project ( really simple atm ) - `dotnet restore` read dependencies from the project.json and download nuget packages - `dotnet compile` call the csc compiler ( with a wrapper `dotnet-compile-csc` ) with source files, defines, references from project.json, etc There is a good split of responsabilities, you can call dotnet-compile-csc if you want. dotnet cli bundle the roslyn compiler ( c#, vb ) and f# compiler, so ready to go for example `dotnet compile`. dotnet compile read project.json and call ( for c# ) the `dotnet-compile-csc` passing source list, defines, references, etc. dotnet-compile-csc doenst know about project.json, and call csc ( the c# compiler ). if --native, the `dotnet compile` then call a compiler from .net bytecode to native code It's more like a replacement for msbuild, with a really good command line story, and a common project file ( project.json ) who can be used from visual studio or vs code, or others ide ( it's a json file, dumb )
- iheartmemcache 11y agoCompletely off topic but I think I saw some of your work in the F# repo being merged upstream. Congratulations if I'm not confusing you with someone else!
- enricosada 11y agothx
- nmeofthestate 11y agoThanks for your comments here - really explained what this thing is. I didn't pick up on that from the blog post.
- abrodersen 11y agoLike another commenter said, thank you for all your work on getting F# into dotnet core!
- darklajid 11y agoThe command line compiler didn't include dependency management, project creation etc.?
- mattmanser 11y agoIf you're going to build via cli, you'll already be using 'nuget restore'[1] as part of a bat file or whatever in your build. And you'd have to be pretty belligerent of VS to use a cli to create a .Net project instead of clicking 'File > New > Project...'. Although the amount of crap they add in to a asp.net project these days is phenomenal. You spend 20 minutes deleting all the junk they've added. It just seems to be a simplification. In all honesty the article doesn't actually say anything really about why we should use it. [1] https://docs.nuget.org/consume/command-line-reference#restore-command https://docs.nuget.org/consume/command-line-reference#restor...
- darklajid 11y agoNo, the article makes that rather clear: You don't have VS on other platforms. This is a cli interface for every supported OS/platform, while you had to use msbuild/xbuild previously (and a couple of things on top, nuget being one). Obviously you can do everything .Net related already - if you're sitting in VS on Windows.
- deleted 11y ago[deleted]
- chiph 11y agocsc.exe did not. In ye olde days, you'd have to use nmake or similar (batch files - gahh!) to manage compiling applications that had multiple source files.