Getting Started with Visual Studio

If you still need to install Visual Studio, check out our earlier article.

Build an App with Visual Studio 2017

by Nicole Bruck

Step 1: Create

We’re going to create an app to display, “Hello, World!”, which we will write in C# and run on Windows, specifically a WPF app.

  • Select File → New → Project…
  • Choose the “WPF Application” project type and name it, “HelloWorld”
  • On the left side, select “Toolbox” to open
  • Choose the push pin icon on the top of the Toolbox window

Step 2: Edit

We’re going to add a text area and button to our app. Then we’ll add an action to our button to display, “Hello, World!”

  • On the bottom of your XAML window, you’ll insert the following code between the “Grid” tags.
  • Alternatively, you may drag the elements from the toolbar and rename them in the editor – precise locations in the canvas are not important.
  • Double-click the button that says, “Talk to me.” in the designer
  • Insert the following code into the button_Click() method
    • namespace HelloWorld
      {
      ///
      /// Interaction logic for MainWindow.xaml
      ///
      public partial class MainWindow : Window
      {
      public MainWindow()
      {
      InitializeComponent();
      }

      private void button_Click(object sender, RoutedEventArgs e)
      {
      MessageBox.Show("Hello, World!");
      }
      }
      }

Step 3: Build & Run

Now we’re going to build the project so we can make sure that all the code works.



If you’re ready to start trying out some of our debugging features, head to our next article: Debug & More.