I can't make it past building the .dll because I keep getting an error that the csc command is no longer supported. And the note that instructs to use dotnet commands isn't helpful without context. When I do try "dotnet run," I get a build error because there's no Main method. I'll admit that I've been confused throughout the process of trying to teach myself C# (so far, I've only gone through Quickstarts), but I'm not sure if these guides are for beginners or people who've worked with programming before. A lot is vague, a lot is unexplained, and it's hard to retain the information without being challenged to use it proactively as opposed to copying code.
⚠Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
@malchikgey I agree that these articles don't look friendly for newcomers, lets wait for @BillWagner so he can approve/triage any changes to these sections in order to improve the barrier to entry.
Until that, let me try to help you with the issue occurred.
If you are on Windows and have Visual Studio 2017 installed, then csc.exe (also known as Roslyn) compiler should be located at "C:\Program Files (x86)\Microsoft Visual Studio\2017\{Community/Professional/Enterprise}\MSBuild\15\bin\Roslyn\".
Navigate to that folder and run csc /t:library {path_to_souce.cs}. It doesn't work for you out of the box because you, for some reason, don't have the PATH environment variable set. See how to set PATH variable on Windows.
Also, dotnet run does not work because the given example isn't intended to be an executable, it is rather a class library which doesn't have an entry point and thus can't be executed via dotnet run (dotnet runtime just don't know where to start from in your program). If you want to build it with dotnet tools please see dotnet build command
@BillWagner please assign this to me, I'll take care about dotnet-tools section.
@d-dizhevsky I just added you as a collaborator. Can you go here and accept the invite: https://github.com/dotnet/docs/invitations Then, I can assign this to you.
Thanks for all the contributions, and your continued interest.
@BillWagner done, thanks.
And assigned. Thanks.
That did the trick! It's still giving me error cs2012, but it created the .dll file.
Started working on this issue and noticed that the tutorial already have an !IMPORTANT section which describes how to use .NET Core build tools and provides a link for tutorial.
====
The examples above use csc as the command line C# compiler. This compiler is a Windows executable. To use C# across other platforms, you should use the tools for .NET Core. The .NET Core ecosystem uses the dotnet CLI to manage command line builds. This includes managing dependencies, and invoking the C# compiler. See this tutorial for a full description of those tools on the platforms supported by .NET Core.
====
@BillWagner I assume this can be closed? Or there some changes you would like me to do anyways?
"If you've done development before, but are new to C#, read the tour of the C# language." I understand it fine and it actually fills in a lot of cracks for me. This article wasn't made for new comers
Removed assignment from myself because, unfortunately, I have no time to work on that at the moment.
@BillWagner, Should the article shows the project creation from the beginning using .NET Core CLI ?
@Youssef1313
This article really needs a complete rewrite. The content is taken from the C# 1.0 Language Specification. It's had minimal updates since then. The tooling has changed, and the features to highlight in the language are very different than when this was written.
One part of that is to use the .NET Core CLI. But that is only one small part.
@BillWagner, Can you point to the parts to consider when rewriting it ?
I may give it a try.
@Youssef1313 I haven't flushed out the full outline, but a top level overview of what this should cover is in this gist
Now that C# 8 has shipped, the tour should include an overview of pattern matching, and non-OO techniques. The first step would be to flush out the outline for all the sections that have the wrench icon in that gist.
I think that means most of this section will be rewritten.
I couldn't figure out how to get it running either until I added the Path variable for the C# compiler to my user Path environment variable. I naively assumed that because Visual Studio 2017 was installed that the Path variable would have been set already so I could just use it from the command line. I found the compiler under "C:\Windows\Microsoft.NET\Framework64\v4.0.30319" and added that to my path variable, but was still unable to compile as it is apparently an outdated compiler. I found that the Visual Studio compiler that supports newer language features is located at "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Roslyn" as someone else already mentioned here. To add that to your Path on Windows 10, press windows key+pause, click Advanced System Settings > Environment Variables, then under User Variables for
Apparently I can't edit my post...I forgot to say, after you save these changes, restart your command console and try to compile again.
Most helpful comment
@malchikgey I agree that these articles don't look friendly for newcomers, lets wait for @BillWagner so he can approve/triage any changes to these sections in order to improve the barrier to entry.
Until that, let me try to help you with the issue occurred.
If you are on Windows and have Visual Studio 2017 installed, then
csc.exe(also known as Roslyn) compiler should be located at "C:\Program Files (x86)\Microsoft Visual Studio\2017\{Community/Professional/Enterprise}\MSBuild\15\bin\Roslyn\".Navigate to that folder and run
csc /t:library {path_to_souce.cs}. It doesn't work for you out of the box because you, for some reason, don't have the PATH environment variable set. See how to set PATH variable on Windows.Also,
dotnet rundoes not work because the given example isn't intended to be an executable, it is rather aclass librarywhich doesn't have an entry point and thus can't be executed viadotnet run(dotnet runtime just don't know where to start from in your program). If you want to build it with dotnet tools please see dotnet build command