✅ Compiling C# file individually
hi, it would be great if anyone could tell me a way to compile C# code directly from 'csc' compiler and I want to use the latest version of compiler. The old version works by: csc filename.cs
The .NET now seem to have C# compiler stored as 'csc.dll' and I can't directly call it from terminal to compile my C# files. What could be the solution?
I've been doing this....1st compiled the '.cs' file and executes the '.exe' file:
4 Replies
you can do it with dotnet path/to/csc.dll, but there's a ton of parameters you'll need to pass
Just make a project
Compiling C# file individuallyNo There's no reason to
First you might learn why you hit the old compiler(s), https://halfblood.pro/the-rough-history-of-the-so-many-c-compilers-f3a85500707c Then you might try to wrap up the individual C# file(s) in project(s),
.csproj
so that you can use MSBuild/.NET SDK to compile them. That's the common way to compile C# code, not calling csc
directly.Half-Blood Programmer
The Rough History of The So Many C# Compilers
A post that summarizes the rough history of the so many C# compilers and interesting stores behind them.
Alright, I will go with the normal way of creating projects for C# code. Thank you everyone.