First App With Visual Studio For Mac

Explore Visual Studio For Mac

Hello guys!

In this article, we’ll learn start to finish about Visual Studio for Mac tools and debugging and how to start with console projects. So first, read my last article to know more about the installation process. When you are done with the installation, just go to your Mac Launchpad to show all applications or open Visual Studio from Application Finder.

Visual Studio

Now, click on "New Project" option to find the project templates provided by Visual Studio.

Visual Studio

I have selected "Console Project" in .NET category. Then, click "Next" to give names to the Project and Solution.

Visual Studio

Give any name of your choice for this demo app. I set FirstCUIAppOnMac as Project name and DemoApp as my Solution name. You can see the solution preview also at the right side of this window. At last, you can change the location of the project source code.

Finally, press the "Create" button.

Visual Studio

Now, if you go to that location where you have created your project, you will get your Solution (.sln) file and project file (.csproj).

Visual Studio
Now, go back to Visual Studio and check what are the files and references we get in default template.

Visual Studio

Just like other Visual Studio versions, we have the same folder structure in Visual Studio for Mac. A little difference here is that we only have one reference by default which is “System”. If you want more, then right click on References folder and find "Edit References" option.

Visual Studio

Now, you’ll get a window where you have options to find your assembly from .NET Assembly or you can browse if you have any custom assembly.

Visual Studio

At the right side of this window, you have a list of all existing assemblies in your project.

Visual Studio

Now, enter any assembly name to search and select. Then, click OK.

Visual Studio

After adding that assembly in your Solution, you can see that in your references.

Visual Studio

If you want to use other main windows on Visual Studio, like Toolbox, Property Window, or many more, then just check the right side.

Visual Studio

You also have a default Program.cs class that has a default Main() function that you can change according to your requirement.

Visual Studio

After developing your app, you need to debug it. So, find the start option at the top left.

Visual Studio

Now, for learning more about Visual Studio for Mac, we need to code more. So, let me add a new file.

Visual Studio

Find the class file to code in C#.

Visual Studio

I just add an Empty class named as Student.

Visual Studio

I am writing some properties for checking the intelliSence. When you try to use them, it gives you intelligence suggestions, as shown in the below image.

Visual Studio

After creating my class, it’ll look like below.

Visual Studio

Now, I have created an object to use that code in my program.cs in Main () with some default values.

Visual Studio

At last, after you are done with the code, just press "Start" button and it’ll start debugging.

Visual Studio

For a proper RunTime in Mac, .NET apps require Mono framework for Mac. Thus, it’ll automatically start Mono.

Here is the output.

Visual Studio

Thanks.

Up Next
    Ebook Download
    View all
    Learn
    View all