You can reduce the quality of photos to speed up the loading of your site
NET 5., the successor to .NET Core 3.1. And .NET Framework 4.8., Intends to bring a new cross-platform development experience to .NET developers. Offer. This brings new good features. Of course, in this article you will not learn everything about .NET 5., but you can focus on 5 to get a better understanding of what is happening.
Success in a media channel such as organic search depends on the content. In particular, the production of useful content has the ability to rank. In its recent algorithm updates, Google has focused heavily on promoting great content and natural links, and penalizing poor content with unspecified links.
JavaScript is a complex language. If you are a JavaScript developer at any level, it is important to understand the basics. This article addresses 12 concepts that are important for any JS developer to understand, but by no means cover the full extent of what a JS developer needs to know.
If you own a website or work on a customer website, then you need to know the importance of SEO. Without proper SEO strategies, you can not get high rankings in Google.
.NET workers and is very popular with developers. But we do not have access to this powerful IDE everywhere. .NET CLI commands help us manage our projects without using Visual Studio. In the continuation of this article, we will get acquainted with how to use them.
CLI stands for Command Line Interface, which is a mechanism for communicating with operating systems and applications and executing specific commands by typing commands. We .NET works typically use the graphical and visual environment of Visual Studio. (The word "Visual Studio" itself means visual environment 😀)
In the Visual Studio environment, we can do a variety of things, such as creating a project or a new solution.
Well, now, for example, you want to write a project on the spot that is not very small, but for example needs a package, or elsewhere (you get it!) You need to use Visual Studio. Because Visual Studio One cannot be installed on every system, our work gets stuck there.
This is where we get to the command line. Learning command line commands for .NET can help you make better use of .NET.
For example, in the Linux operating system we can not use Visual Studio, but there we have a great VSCode editor. Well VSCode has a terminal that executes exactly the same commands (something like Windows Power Shell!) And we can easily create our own projects, debug, output and ...
I want to remind you of the most widely used and useful CLI .NET commands.
Before that we need to have .Net Core. .Net 5.0 will be great if you install.
You can use this link to download
When we create a new project in Visual Studio. First, Visual Studio creates a solution for us, and then it creates a project and throws that project into the solution that it created, and then we make a change on that project, and then we build our project and that. We run and test and debug and then release it as a release, and here the software development process ends. It remains until we want to update the method again later and when we come again and open that solution, we change and ...
Now let's do the same with CLI!
Well, to get started, we create a folder and name a method (preferably a project name). We use the name SayHello here. (We want to write a program that receives a name from the user (for example Ali) and tells the user Hello Ali)
Now we open the Power Shell and here begins the fascinating and beautiful process of grammar.
We need a solution, but we must first go to the location of the folder we created. There are two ways to do this. The first way is to hold down the Shift key and right-click on the folder and select Open Power Shell Window Here:
Now Windows PowerShell opens in our folder location
But there is another way is to go to our folder with the cd command:
Now we are in our own folder. And here we have to order .NET. To create a solution, we use the following command:
This will create a solution in the folder we created. The new solution is the same name as the folder.
By entering the above command, you will see something like this:
If you go to the folder location you will see an empty solution with the same name as the folder created and we do not have a project in this solution yet:
If you want the created solution to have another name, you can write the following command:
Here we have to create a new project.
The dotnet new command is for creating something new. Now it can be an app console, a solution (which we created above to create a new solution) and ...
Here is a table that shows us what we can create with dotnet new. Just type the short name of each one you want in front of the dotnet new command:
Templates | Short name | Language | Tags | Introduced |
Console Application | console | [C#], F#, VB | Common/Console | 1.0 |
Class library | classlib | [C#], F#, VB | Common/Library | 1.0 |
WPF Application | wpf | [C#], VB | Common/WPF | 3.0 (5.0 for VB) |
WPF Class library | wpflib | [C#], VB | Common/WPF | 3.0 (5.0 for VB) |
WPF Custom Control Library | wpfcustomcontrollib | [C#], VB | Common/WPF | 3.0 (5.0 for VB) |
WPF User Control Library | wpfusercontrollib | [C#], VB | Common/WPF | 3.0 (5.0 for VB) |
Windows Forms (WinForms) Application | winforms | [C#], VB | Common/WinForms | 3.0 (5.0 for VB) |
Windows Forms (WinForms) Class library | winformslib | [C#], VB | Common/WinForms | 3.0 (5.0 for VB) |
Worker Service | worker | [C#] | Common/Worker/Web | 3.0 |
Unit Test Project | mstest | [C#], F#, VB | Test/MSTest | 1.0 |
NUnit 3 Test Project | nunit | [C#], F#, VB | Test/NUnit | 2.1.400 |
NUnit 3 Test Item | nunit-test | [C#], F#, VB | Test/NUnit | 2.2 |
xUnit Test Project | xunit | [C#], F#, VB | Test/xUnit | 1.0 |
Razor Component | razorcomponent | [C#] | Web/ASP.NET | 3.0 |
Razor Page | page | [C#] | Web/ASP.NET | 2.0 |
MVC ViewImports | viewimports | [C#] | Web/ASP.NET | 2.0 |
MVC ViewStart | viewstart | [C#] | Web/ASP.NET | 2.0 |
Blazor Server App | blazorserver | [C#] | Web/Blazor | 3.0 |
Blazor WebAssembly App | blazorwasm | [C#] | Web/Blazor/WebAssembly | 3.1.300 |
ASP.NET Core Empty | web | [C#], F# | Web/Empty | 1.0 |
ASP.NET Core Web App (Model-View-Controller) | mvc | [C#], F# | Web/MVC | 1.0 |
ASP.NET Core Web App | webapp, razor | [C#] | Web/MVC/Razor Pages | 2.2, 2.0 |
ASP.NET Core with Angular | angular | [C#] | Web/MVC/SPA | 2.0 |
ASP.NET Core with React.js | react | [C#] | Web/MVC/SPA | 2.0 |
ASP.NET Core with React.js and Redux | reactredux | [C#] | Web/MVC/SPA | 2.0 |
Razor Class Library | razorclasslib | [C#] | Web/Razor/Library/Razor Class Library | 2.1 |
ASP.NET Core Web API | webapi | [C#], F# | Web/WebAPI | 1.0 |
ASP.NET Core gRPC Service | grpc | [C#] | Web/gRPC | 3.0 |
dotnet gitignore file | gitignore | Config | 3.0 | |
global.json file | globaljson | Config | 2.0 | |
NuGet Config | nugetconfig | Config | 1.0 | |
Dotnet local tool manifest file | tool-manifest | Config | 3.0 | |
Web Config | webconfig | Config | 1.0 | |
Solution File | sln | Solution | 1.0 | |
Protocol Buffer File | proto | Web/gRPC | 3.0 |
The general structure of .NET CLI commands is as follows:
1. the word dotnet
2. Command (for example, creating a new solution (dotnet new sln))
3. Arguments
4. Settings (for example, in what language .NET languages (such as C #, F #, VB) are made).
Or in other words: dotnet <command> <argument> <options>
Now let's move on to our job of building a console project. As you know, the following command is used to build a console project:
dotnet new console
Still waiting!
Now we have to give him the options of this console project.
If you press like this and the command is executed, it will create a project with the default settings.
But I want you to learn its settings so that you can be full.
If you type h in front of the dotnet new console command, you will encounter something like this:
We now only need a few important options that are widely used
N- or name- option:
This option is to put a name on the project or file we want (like the same command we wrote to create a solution with the desired name!)
-Lang or –language option:
This option is to set the programming language of the project, which is selected from C #, F # and VisualBasic languages:
In the above command, we chose our language as Basic Basic (do not worry, I basically want to work in C #). To do this, abbreviate the word Visual Basic, which can be VB in two double quotes
Well, we told these two to go to the main task of creating a C # project and ...
Do you know what command to write:
Now we have a project called sayhello-app that is going to be written in C #.
Now let's take a look at the first folder we created and see that we have a folder called sayhello-app (the name of the project we created):
Let's take a look inside the sayhello-app folder:
Look at their types.
Exactly like the projects we make with Visual Studio.
Now we need to add our project to the solution (the same solution we created).
To do this, we use the following command:
Well, let me explain the above command to you
You know the first part (dotnet sln) that we worked on. The word add we said was to add a project to our solution.
Then we came up with the name of the project and put a back slash (/) to separate it from the next argument.
The next argument is the project file path (stored in csproj in cspro, fsproj in f # and vsproj in Visual Basic. This file contains general project information), which is measured relative to the location of the solution.
Now our project has been added to the solution and we can open this solution with the studio itself.
But the time for programming has come
(We did all this work, but know that when you learn this, you can create and manage a project faster than Visual Studio itself 😁)
Open the Program.cs file (Program.fs in F Sharp and Program.vb in Visual Basic) with an editor code (it can be done with Windows Notepad, but I use VSCode to show you the terminal).
If you want to work with vscode, first right-click on your project folder and select Open with Code:
Now Pushmon runs with Visual Studio code:
We enter the program file and well, here he has given us back things as an example. Because maybe the person reading this article is not C # and I do not want to learn C#, I do not say why, but we write the same code:
Our friends used to give our instructions to .NET with the power shell of Windows. But vscode has thought of everything and put a terminal that does exactly what Power Shell does, but here it is, and I, as a programmer, say, "It makes my job a lot easier and faster!"
Now let's go to the terminal
To create a new terminal, select the New Terminal option from the Terminal menu to create a new terminal for us:
Now we write our commands directly in the terminal:
To run a project, go to the folder where the project file is located and write the dotnet run command:
And now the program is running and we have to name it so that it can greet us:
The program exe file is also located in the \SayHello\sayhello-app\bin\Debug\net5.0 folder:
If you want to set what framework to run, use f-:
This table is also for CLI framework names:
Target Framework | TFM |
---|---|
.NET 5 (and .NET Core) | netcoreapp1.0 netcoreapp1.1 netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1 net5.0* |
The friends of this article were mostly familiar with CLIs in .NET. Take a look at your Microsoft articles to learn more.
I hope you are successful and your plans do not bug 😉
User:ToProgramming
1/1/2021
Visit:86
CSharp