C# tutorial – Visual Studio Express installation, C# Hello World! 45

C# Hello World

facebooktwittergoogle_pluslinkedinmail

Ok, you’re interested in C#. So the basic question you might have is how can I begin? Good question, let me present a kick-start.

To develop C# application you need a development environment. For C# development (but not only) you can use Visual Studio which is excellent IDE (Integrated Development Environment). There are many versions of Visual Studio – compare Visual Studio products. The most interesting for new C# or .NET enthusiast is Visual Studio Express – it’s free version that anyone can use for C# development EDIT: Microsoft has released Visual Studio 2013 Community – it’s much more powerful than Visual Studio Express edition and it’s free as well. It have some limitations, like no support for Visual Studio plugins but this is not an issue for beginners. You can get Visual Studio Express here. There are few editions available and I recommend getting Visual Studio Express for Desktop as it’s perfect for general C# development.

Visual Studio 2013 Express installation

After you download and run the installer, you will see loading screen (it might hang for a while):

1

Then you will need to agree to the license and privacy policy.

I agree

Next click big INSTALL button and agree for elevated mode.

install

Finally, the installation will proceed.

5

After the installation a reboot is required. Finally, when you start Visual Studio Express it will ask you to sign in (you can skip it). Be patient as first start will take a while.

Hello, World – the first C# application

To create your first application open Visual Studio and click ‘FILE’ menu, then ‘New Project’. A new window will pop-up. Please select ‘Visual C#’ template on the left panel and a list of C# project types will be presented – few words about each of them:

  • Console Application – the simplest application (without graphical interface)
  • Windows Forms Application – application with graphical interface based on Windows Forms framework
  • WPF Application – application with graphical interface based on Windows Presentation Foundation
  • Class Library – libraries are created to separate code that could be re-used between different applications

Please choose Console Application and put application name in ‘Name’ field (something like ‘MyFirstApplication’).

image

After Visual Studio creates the project you will see Solution Explorer on the right side (by default). Please notice that you can reorganize Visual Studio windows freely (drag-and-drop).

image

When you created MyFirstApplication project, Visual Studio also created a solution. Solution is just a group of projects. Currently you will see just one project, but you can add more (e.g. by adding new class library). In the Solution Explorer you can see everything that belongs to your project.

  • Properties – If you expand it, you will see AssemblyInfo.cs file. It’s a metadata file which contains information like: version, product name, company name, copyrights, etc.
  • References – Contains a list of all libraries required by the project. By default there will be few basic libraries from .NET Framework
  • App.config – A configuration file. .NET Framework have a nice way to use it.
  • Program.cs – Finally, the place where you will find proper C# code.

Let’s have a look at Program.cs file.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MyFirstApplication
{
    class Program
    {
        static void Main(string[] args)
        {
        }
    }
}

To print a message insert following code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MyFirstApplication
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hello, World!");
        }
    }
}

Now press Ctrl+F5 to run the application. You should see a console window with following output.

Hello, World!
Press any key to continue . . .

That’s it. You just created your first C# application, well done!

Next time I’m going to explain what the code from this application means (Object-oriented programming and basic C# syntax).

facebooktwittergoogle_pluslinkedinmail

Leave a comment

Your email address will not be published. Required fields are marked *

45 thoughts on “C# tutorial – Visual Studio Express installation, C# Hello World!

  • Buck

    Good day! I simply want to offer you a huge thumbs up for your excellent info you have here on this post.

    I’ll be coming back to your website for more soon.

  • ChandraYHauser

    I have read so many content on the topic of the blogger lovers however this article is
    genuinely a fastidious article, keep it up.

  • ReyesDSpalla

    I feel this is among the such a lot vital information for me.
    And i am happy studying your article. But want to
    observation on few normal things, The web site style is ideal, the articles is actually nice : D.

    Good activity, cheers

  • here are the findings

    I just want to mention I’m new to blogs and honestly liked you’re web blog. Very likely I’m want to bookmark your blog . You amazingly come with incredible stories. Regards for revealing your webpage.

  • KamilahKKave

    Hi there, I desire to subscribe for this website to
    get most recent updates, therefore where can i do it please help out.

  • ClydeKWene

    Hello Dear, are you genuinely visiting this web page on a regular basis,
    if so then you will definitely get good experience.

  • CristopherLLongford

    Hi, I think your site might be having browser compatibility issues.
    When I look at your blog site in Safari, it looks fine but when opening in Internet Explorer, it has some overlapping.
    I just wanted to give you a quick heads up! Other then that, excellent blog!

    • Mariusz Bojkowski Post author

      Thanks for your feedback. I’d need few more issues to investigate it.
      Could you please let me know which version of IE you have?
      On which page you experience overlapping?
      Thanks in advance

  • ChantellOFriede

    Excellent blog you have here but I was curious if you knew of any community forums
    that cover the same topics talked about here? I’d really like to
    be a part of community where I can get responses from other knowledgeable people that share the same interest.
    If you have any suggestions, please let me know. Thank you!

  • This Site

    I simply want to mention I’m newbie to blogs and really enjoyed this web page. More than likely I’m going to bookmark your website . You surely have fantastic well written articles. Regards for sharing with us your blog.

  • sdorttuii plmnr

    Hey I am so glad I found your blog, I really found you by error, while I was searching on Bing for something else, Nonetheless I am here now and would just like to say thanks for a tremendous post and a all round interesting blog (I also love the theme/design), I don’t have time to browse it all at the moment but I have saved it and also included your RSS feeds, so when I have time I will be back to read a lot more, Please do keep up the superb work.

  • read the full info here

    I simply want to tell you that I’m very new to blogs and truly enjoyed you’re web blog. Most likely I’m planning to bookmark your site . You certainly have very good posts. Thank you for sharing with us your website.

  • quest bars

    Hi, I think your site might be having browser compatibility issues.
    When I look at your website in Opera, it looks fine but when opening in Internet Explorer,
    it has some overlapping. I just wanted to give you a quick heads up!
    Other then that, superb blog!

  • quest bars

    I read this article completely regarding the resemblance of newest and previous technologies,
    it’s awesome article.

  • click reference

    I just want to tell you that I am just newbie to blogs and absolutely savored your web blog. Probably I’m likely to bookmark your website . You definitely have impressive articles and reviews. Cheers for sharing your web-site.

  • plenty of fish dating site of free dating

    Your style is really unique compared to other people I have
    read stuff from. Thanks for posting when you have the opportunity,
    Guess I’ll just bookmark this blog.

  • you could check here

    I just want to say I am new to blogging and seriously loved your website. Probably I’m planning to bookmark your blog post . You actually have remarkable writings. Kudos for sharing your blog.

  • furtdsolinopv

    Hi my friend! I wish to say that this post is amazing, nice written and include almost all vital infos. I’d like to see more posts like this.

  • next

    I just want to say I am newbie to blogs and truly liked this website. More than likely I’m likely to bookmark your blog post . You absolutely have really good stories. Appreciate it for sharing your web-site.

  • browse plenty of fish

    It’s a shame you don’t have a donate button! I’d most certainly donate to this fantastic blog!

    I suppose for now i’ll settle for book-marking and adding your RSS feed to my Google account.
    I look forward to brand new updates and will share this website with my Facebook group.
    Talk soon!

  • plenty of fish

    What’s Taking place i’m new to this, I stumbled upon this
    I have found It absolutely useful and it has aided me out loads.
    I’m hoping to give a contribution & aid different users like its helped me.
    Great job.

  • sdorttuiiplmnr

    Very well written story. It will be helpful to anyone who employess it, as well as yours truly :). Keep doing what you are doing – for sure i will check out more posts.