P M A J E W S K I

Please Wait For Loading

Using Visual Studio Code to create .NET application - Software Developer's Tour

visual studio code icon

Using Visual Studio Code to create .NET application

Many of us use Visual Studio Code for frontend purposes, but how about using it to develop an .NET Applications?

I always use Visual Studio or Rider to develop .NET apps, but today, I’ll create a simple TODO application using Visual Studio Code to check if I’m able to create the application in a convenient way.

visual studio code main window

As first glance, we can see the “Create .NET Project” button which allows us to create an application with a few clicks.

create .NET application menu

I’ll choose standard MVC application as easiest way to test VSC in real application.

public class TodoItem
{
    public string Title { get; set; }
    public string Description { get; set; }
    public TodoItemStatus Status { get; set; }
}

I’ve modified HomeController and added TodoItems storage as static list

    public static List<TodoItem> TodoItems = [
        new() {
            Title = "Write new post",
            Description = "Go to the pawelmajewski.com and add a new post",
            Status = TodoItemStatus.New
        }
    ];

And the result

Ok, let’s stop at this moment. I’ll write something about using Visual Studio Code and the feeling of using it instead of a dedicated IDE created for .NET applications.

TodoItem class

As you can see, VSC doesn’t add namespace by default.

add namespace

None of these options generate correct namespace automatically. The first option ends word to full “namespace” and the second one creates new namespace scope. Too bad I couldn’t find such an option to generate correct namespace with consideration for the folder structure.

Summary

Visual Studio Code is amazing software with a vast amount of extensions. We can easily develop .NET applications using Visual Studio Code. There are many extensions available that make our job faster and more convenient. However, in my opinion, the usage of dedicated IDEs is a better option. I’ll stay with Rider / Visual Studio for .NET and Visual Studio Code for frontend 🙂

leave a comment