October 30, 2014
Hot Topics:
RSS RSS feed Download our iPhone app

Writing Applications in the Cloud with Visual Studio Online

  • August 27, 2014
  • By Vipul Patel
  • Send Email »
  • More Articles »

Introduction

With the move to cloud-based services, even project development has gone to the "clouds". Microsoft now offers Visual Studio Online, which supports all aspects of project development in the cloud. In earlier articles http://www.codeguru.com/tools/beginners-guide-to-visual-studio-online.html and http://www.developer.com/net/managing-projects-backlog-with-visual-studio-online.html, we got some insights into the offering.

In this article, we will explore how we can actually code and build using the new "Visual Studio Online" offering.

Hands On

For our hands-on experience, if you have not signed up for Visual Studio Online, please do so before proceeding. Go to your Visual Studio Online account and create a new project (if you do not have one already).

Cloud01
Figure 1: Creating a new project

Click the "Create Project" button to create the project.

Next, if you have not installed the Visual Studio 2013 Update 2, please install it now. Next, we will create a demo application in Visual Studio 2013 and configure it to have our source code hosted at Visual Studio Online.

Fire up Visual Studio 2013, and create a new Windows Desktop console project titled "DemoConsoleApp". Make sure you have the "Add to source control" checkbox checked and click OK.

Cloud02
Figure 2: Creating a new DemoConsole app

Select Team Foundation Version Control when prompted to select the source control system for the new project.

Cloud03
Figure 3: Choosing the source control

Select the Project we created in Visual Studio Online and click OK. If the mapping of the project hasn't been done before, you will be asked to map the Visual Studio Online project to a local workspace.

Adding the app to the demo
Figure 4: Adding the app to the demo

Our project is now created locally.

At this time, we should, as a best practice, commit the project to the source control. To do that, go to Team Explorer.

Cloud05
Figure 5: In Team Explorer

Your team explorer window will appear as shown in Figure 6.

Cloud06
Figure 6: The Team Explorer screen

Click the Pending Changes link to view the open changes that need to be committed.

Cloud07
Figure 7: The Pending Changes screen

To commit the code, we have the option to get a code review or skip and commit it directly. For our demo, we will commit directly.

Enter a comment and click the "Check In" button. You will be asked to confirm the commit.

Cloud08
Figure 8: The Check-in Confirmation screen

Click Yes to proceed with the commit. Once the commit is successful, you will not see any open changes. Next, we will set up "building our changes" in the cloud.

Building in the Cloud

Go to Team Explorer Home and click Builds.

Cloud09
Figure 9: The Builds button is available

You will see the Build view.

Cloud10
Figure 10: The Build view

Click "New Build Definition" to start creating a build definition. We will see the workflow step to creating a new build definition.

Cloud11
Figure 11: Creating a new build definition

We can define the trigger for auto builds, but select "Trigger" now. For our case, we will make this "Continuous integration" to build the changes after each check-in.

Cloud12
Figure 12: Defining the trigger for auto builds

Click the Save button to save the build definition.

Next, we will make code changes and commit it to see the automated build step in action. We will intentionally cause a build-break by missing a ";" at the end of the statement.

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

namespace DemoConsoleApp
{
   class Program
   {
   static void Main(string[] args)
      {
         Console.Write("hello") 
      }
   }
}

Check in the new change. Open the Pending changes view on Team Explorer and click "Check in".

Cloud13
Figure 13: The Pending Changes window

Next, we will visit the Builds view on Team Explorer to check the status of the build.

Cloud14
Figure 14: Checking the status of the build

After a few minutes, we can see that the build failed.

Cloud15
Figure 15: The build has failed

Double-click on the build to see the details.

Cloud16
Figure 16: Viewing the details

We can see that the error is due to a missing ";" at the end of the statement. We also can see that a new bug 36 was created because of the build failure.

Cloud17
Figure 17: Observing the error message generated by the build failure

Now, let us fix the build break.

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

namespace DemoConsoleApp
{
   class Program
   {
   static void Main(string[] args)
      {
         Console.Write("hello");
      }
   }
}

And Commit the changes. When commiting, make sure to associate the change with the bug # as shown below.

Cloud18
Figure 18: Committing to the changes

Click Check In to commit the code. We can monitor the progress by double-clicking the build.

Cloud19
Figure 19: Monitoring the progress

After a few minutes, we can see the progress of the build and see that it completed successfully.

Cloud20
Figure 20: A successful build

Summary

In this article, we learned about building applications in the cloud using Visual Studio Online.

About the Author

Vipul Patel is a technology geek based in Seattle. He can be reached at vipul.patel@hotmail.com. You can visit his LinkedIn profile at https://www.linkedin.com/pub/vipul-patel/6/675/508.


Tags: Cloud, application, Visual Studio Online




Comment and Contribute

 


(Maximum characters: 1200). You have characters left.

 

 


Sitemap | Contact Us

Rocket Fuel