Configuration in .NET Core

#dotnet #net-core

.NET Core and .NET Standard

A nice article from MSDN Magazine:
.NET Standard – Demystifying .NET Core and .NET Standard
And a great video series about .NET Standard from the same author:


MySql with ASP.NET Core

  1. Create the project: dotnet new console
  2. Add mysql package: dotnet add package MySql.Data
  3.  Optional: Add an ORM: dotnet add package Dapper
  4. Start vscode: code .
  5. Connect and and query
  6. Run the code: dotnet run

     static void Main(string[] args)
            MySqlConnectionStringBuilder conn_string = new MySqlConnectionStringBuilder();
            conn_string.Server = "SERVERAdress";
            conn_string.UserID = "USERid";
            conn_string.Password = "Pws";
            conn_string.Database = "Db";

            MySqlConnection connection = new MySqlConnection
                ConnectionString = conn_string.ToString()

            MySqlCommand command = new MySqlCommand("SELECT * FROM Notes;", connection);

            using (MySqlDataReader reader = command.ExecuteReader())

                while (reader.Read())
                    string row = $"{reader["NoteId"]}\t\t{reader["NoteTitle"]}\t\t{reader["NoteText"]}";



#asp-net-core #mysql #mysql-with-net-core

.NET Core Command Line CLI Basics

Yes, developing .NET apps without opening Visual Studio was something I wish for a long time. It was possible but wasn’t that simple. With .NET Core CLI, managing the project is simpler than ever. Let’s see how we can create a new project, build and run and learn some more commands.

1. Creating a Project/Solution & Adding Project to a Solution

After going to the folder you want to create the project. You can just type

 "dotnet new"

This will not work but you will see the options you can use.

For an MVC project, you can use

 "dotnet new mvc"

For a console app, use

 "dotnet new console"

If you want to create the project in a folder with a solution name you desire, use

 "dotnet new mvc -n MyNewMvcProject"

Once you do any of above, the files for the project will be created and you can jump start working on your projects. Details for the “dotnet new” command can be found here >>>

If you want to add projects under the solution, use “dotnet sln []” command. Click to see more details.

2. Running / Building the Projects

For running the project quickly, use

dotnet run

If you get an error of missing files, you have to restore the packages. Use

 dotnet restore 

This restores the dependencies and tools of a project that are specified in the project file. Note that “dotnet run” command, takes care of compiling and building the project as well. It runs “dotnew build” before it runs.

3. Adding Packages to the Projects & Adding Projects as Reference

You can use “dotnet add package PackageName” to add a package from NuGET. For example, to add Newtonsoft.Json, use

dotnet add package Newtonsoft.Json

You can specify the URL of the package as well:

dotnet add package Microsoft.AspNetCore.StaticFiles -s

The commands above must be the most used ones. For all, please visit the official article on microsoft >> .NET Core command-line interface (CLI) tools

#net-core #net-core-command-line-basics, #dotnet-core-cli-basics, #dotnet-new #dotnet