So I recently figured my .NET compiler is outdated, seeing as it can't use static imports (using static ...
), so I was here to ask, how do I update it?
I tried redownloading .NET, and looking up how to update, but neither of which were really helpful. So can someone explain the steps of updating?
Thanks!
Cheers!
Cheers!
Top comments (14)
You can get the latest .NET SDKs from here: dotnet.microsoft.com/download
Alternatively, you can install visual studio, which should also install the latest SDK.
I recommend using the command “dotnet build” (or run) as opposed to csc, as the dotnet project workflow makes managing dependencies easy (especially when used with Visual Studio).
I tried this (as I thought I've said in the post), but
csc.exe
inC:\Windows\Microsoft.NET\Framework\<version>\
won't update (as in, a new verson folder won't be added (not the actual file updating)).How can I get the new version folder, so I can add it to my PATH?
So, how do I actually use any of that shit?
Primarily;
What happens if I don't make/have a
csproj
file?Do I have to do anything with the file when it's generated?
Why the fuck is it always more complicated than just a language and the compiler/interpreter, why is all this bullshit here, when I just want to do something simple (similar concept applies to Java)?
I just generated whatever this bullshit is.
LIKE, WHAT EVEN THE FUCK DOES THAT MEAN!?!?
I've battled the same issue and this is what I found out:
stackoverflow.com/questions/685189...
So, then how do I use the modern CLI tool(s) (as far as I know, just
dotnet
) to compile mytest.cs
s?Can you explain what exactly this does?
I really don't understand, and I can't see why there isn't a
dotnet compile <file)s)>
.Thanks for your help.
Cheers.
Doing
dotnet new console
creates a new “console” project in the current directory.It creates two files - a
.csproj
and aProgram.cs
file. TheProgram.cs
file contains your code (you can add as many extra cs files as you want). The.csproj
file contains information that helps the compiler understand how to build (aka compile) your project. For example, what libraries to use, what framework to build it for, whether to ignore certain warnings etc. Theobj/
folder can be ignored.In that project directory, you can use the command
dotnet run
to run your project. Alternatively, you can dodotnet build
to compile it, and then you can manually click the exe in thebin
folder.It is worth installing visual studio, as it provides a nice interface to manage all this stuff.
Why is it built to look like XML, though? Tgat shit is fucking confusing to understand, or remember.
It would have been btter if they made it look like, or be INI/JSON.
Can you send me a tutorial on how to use this?
Uhhh, are you a bot? This is totally irrelevant.
Don’t interact with them, just report as spam and move on.
Where's the "report" button?
Three dots (top left of comment) -> report abuse.