DESKTOP

What's New In Visiual Studio 2012

1/31/2013 6:20:45 PM

The release of Windows 8 and Surface tablets has been the biggest news from Microsoft this autumn, The new OS is largely touch-based and, while it will support traditional Windows applications, it signals a shift in the way future Windows apps will be created. Microsoft sees the emphasis shifting towards data. (Google's Eric Schmidt claimed recently that more data is now generated every two days than was created between the dawn of man and 2009!)

As we create this astonishing torrent of data, the methods of accessing it must become ever more varied and simple, and new-generation apps because they'll be accessing data held in a variety of places, sometimes via unreliable or slow connections must be designed in such a way that they can talk asynchronously to any data source, either locally or out on the internet. Microsoft is calling this new generation of apps "Modern applications", although what we'll call the following generation then becomes problematic - "Even More Modern Applications", perhaps?

Using asynchronous in place of synchronous communication permits applications to remain responsive to user interaction while data is fetched in the background, whereas more traditional synchronous methods cause an application to pause until a data fetch is complete. It may appear to have hung, an effect we've all experienced. Asynchrony has been possible for some time of course, but the release of NET Framework 4.5 and Visual Studio 2012 (V52012) make it easier to implement.

visual-studio-2012 .net-4.5 .net-framework

Visual Studio 2012 .net-4.5 .net-framework

For example, the simplest method now of calling asynchronously is:

Dim urlContents As String = Await

client. GetStringAsyncQ

This new Await command suspends execution of the current method until the awaited task is complete, but in the meantime it returns control to the caller of the method, so that your program can continue to run and avoid the impression of hanging while this data is being fetched. The normal way to build a data-based web application is to build a web service that accesses the database, then query this web service from within your application.

There's an improved version of the Entity Framework to enable this web service to access and consume data that your application can then use, which I'll cover more fully in a future column. One of the new features of this framework is the ease with which it can be updated when the data structures change, even with live data: previous versions required you to drop the database objects and recreate them bad news for a live website. Thankfully, this has now been fixed, along with several other bugs.

Obviously, if you're developing for Windows then Visual Studio will have always been your desktop development tool of choice, but what about web development? I don't intend a full review of Visual Studio here, but I'd like to highlight those areas that will be of interest to web developers, including new ways of designing apps. For such details, visit http://tinyurl. com/7woo5me.

The launch of Windows 8 also sees the launch of the Windows Store. Like Apple's popular iTunes Store, this is a marketplace for developers to submit their apps for approval by Microsoft, after which they can be sold or given away to users. In fact, the only way to install Windows RT apps on many devices will be through this store. To develop for the Windows Store in Visual Studio you first have to register for a developer's account, which does rather smack of Big Brother. There are considerable benefits to the developer, who can thereby easily reach millions of Windows users, but how does a developer ensure their app appears high on the list? Developers can already reach all users out there via the web, so do we really need this extra policing of apps and control of sales by yet another large corporation?

windows store windows 8

windows store windows 8

Let's hope this new sales route doesn't lead to a race to the bottom, with apps becoming ever cheaper. This results in reduced revenues for all but those lucky few developers who hit the big time, along with many poorly-supported, limited-functionality apps that are no more than five-minute wonders. The Windows Store isn't the only way to develop apps, but it's the only way to produce Windows RT apps that appear on the Start screen. Normal Windows applications can be installed in the traditional manner via the desktop, and of course web applications have no restrictions, but for tablets and the Windows Phone, apps will need to be delivered via the Windows Store.

Like many others in the industry, I use a variety of development tools, each of which has its strengths. Dreamweaver is great for maintaining traditional HTML and ASP websites, while Expression Web is useful for designing style sheets with support of CSS styles and good preview capabilities. Visual Studio is great when coding and developing ASP.NET sites, and I also use Notepad++ and Firebug for JavaScript, plus many others that come and go on my development box depending on the job.

While Visual Studio has been useful for ASP.NET development, it was always weak on the design side. JavaScript coding was possible in it, but always felt like a feature added to placate, with support not going far beyond syntax checking with IntelliSense. But this is about to change as JavaScript, HTMLS and CSS become the major ways to build Windows Store applications. The new version of Visual Studio needed to be greatly improved in this area, and it is. So if you develop in web technologies and haven't used Visual Studio before, now may be the time to give it a try: the Express version is free and totally usable, while all the other versions are free for a 90-day trial period.

If you develop in Silverlight then it may be better to use Microsoft's Expressions Blend tool to design, and perhaps for the basic coding too. Now Blend has been built into VS2012, which is a great boon not only for Silverlight developers, since it can also be used as a design tool for Windows RT when creating Windows Store apps. However, be aware that this is currently only possible on a Windows 8 box.

If you're looking for help in designing a Windows Store app that uses HTML and JavaScript, then VS2012 is a huge disappointment, since it lacks a Design View. This is very different from writing web apps in Visual Studio, where there's always been a Design View (not a very accurate one, but useful nonetheless). As before, one gets the impression that development of the underlying technologies has been so rapid that there's been no time for maturing the design tools are playing catch-up and suffer greatly in both usability and functionality. This is a shame, since drag-and-drop positioning of elements and a correct preview could turn Visual Studio into the ultimate HTML design tool. Until that happens, it's still very much a coder's tool, with testing of style sheet changes having to be done by previewing in a browser. Web application developers must carry on waiting for their holy grail a tool with a Design View as good as Visual Studio 6 was for desktop applications.

Once your handcrafted, carefully honed killer app is finished, Visual Studio fully integrates with the Windows Store to enable you to sell it to the millions of Windows users around the world. For teams of developers, there's a full versioning and testing system built into the more expensive versions of Visual Studio. VS2012 can co-exist on your machine with previous versions an important consideration that ensures your previous code remains editable and won't be broken by the new version of the.NET framework.

Visual Studio's interface (2012)

Visual Studio's interface (2012)

Installation is interesting because, for the first time, it allows you to select onto which hard drives it will install: previous versions of Visual Studio, like many of Microsoft's core products, installed large parts of itself onto the C drive without any option to change this. These days, when boot drives are often SSDs for performance reasons, space on them has once again become critical. This isn't to say that Visual Studio installs nothing on your boot drive far from it. The bulk of it, however, can now be moved to an alternative drive.

On my PC, the installation occupied just over 2MB on the C drive, with almost 3GB on my far larger D drive. Installation was quick since I'd selected "web install", which only downloads the files needed for your particular machine and choice of options: the first time you run VS2012, it will ask you to select the content you want, and then customise your installation to the types of development you do. I'm greedy by nature and like to be able to code in several areas, so I selected almost all. The installation went off to add them, which took the rest of the day; 242 modules were required!

Once this was done, I was ready to have a proper play. If you want to use jQuery, you'll need to add support for it using the get manager.net is an open source method for retrieving collections of files, sometimes from various servers, and it also handles disconnected downloads seamlessly. It's been in use for a long time in the open source community, but it's only relatively recently that Microsoft has adopted it within its development tools. Normally Nget is command-line driven, but while VS2012 can offer you an Nget console should you prefer or need to go down this route, it also has a good UI to access the various modules and add functionality such as jQuery.

When programming in JavaScript, or in one of its many libraries such as jQuery, debugging can become an issue. Many of us use the excellent Firebug add-in for Firefox, but there's been a full debugging ability for JavaScript within Visual Studio for some time now (although to judge by the forums, getting it to work confuses many people). It's easy to enable JavaScript debugging in Visual Studio, but you'll first need to go into your web browser; in its advanced internet options make sure the line "Disable client-side debugging" isn't checked. That's all there is to it.

I don't recommend unchecking this setting for all your browsers, since this will cause debugging messages to frequently appear if there's a broken script on a website you're visiting. For my own setup I use Chrome as my default browser, Internet Explorer as the default browser when in Visual Studio, and Firefox for all other JavaScript debugging a configuration that works for me. Obviously, these browsers and others need to be used when testing a new website but, to be honest, with correctly written CSS the differences between browsers these days are small and what differences there are have minimal to no effect on the user's experience of your site. In fact, if you're using a modern responsive web design, your site will probably be changing itself between various user agents that is, browsers anyway.

Visual Studio Default View Visual Studio, Setting the Default View

Visual Studio Default View Visual Studio, Setting the Default View

A feature that I find useful has been enhanced to include HTMLS code, and that's what I call the "double tabbing" method of writing program code in Visual Studio. To give you an example of what it is and its worth, imagine you want to use the new "video" tag in HTMLS. As you may have discovered already, this tag is still a mess. You have to provide three different versions of your video for the major browsers and your code needs to reflect this, making the syntax laborious. Now in VS2012, you just need to type "< vid". A dropdown will appear with "video" highlighted, and if you now hit the Tab key twice, the following code is inserted into your web page:

<video controls="controls">

            <source src="file.mp4"

type="video/mp4" />

<source src="file.webm" type="video/webm" />

<source src="file.ogv"

type="video/ogg" />

</video>

This feature is also of great use when designing responsive style sheets since it helps you build the code for running media queries in the CSS. If you type @media in the style sheet and hit Tab twice, you'll get:

@media only screen and

(max-width:1024px) and (max-height: 768px) { }

This enhancement to the IntelliSense engine works for almost all code, but its addition to HTML in particular is a great help. Reading through the "what's new" notes for VS2012, I noticed that it says there's more support in the CSS editor for some of the new, but yet to be fully confirmed, style standards such as "border- radius" (which enables those nicely rounded corners that used to be trouble to create before).

Regrettably, like many promises, it isn't as truthful as you might hope. Sure, the IntelliSense engine now recognises the term as you type it, but if you select "modify style" to alter or create a style, the borders won't appear in the "box" tab. It's interesting to note that Microsoft's Expression Web has had such support for more than a year now.

When checking your work, VS2012 Design View doesn't show these curved borders either, so you'll see them only if you preview in a browser, much as you would in Dreamweaver, It's a shame that Microsoft has done so little to provide real help to HTML designers. While CSS pseudo-elements are now supported by IntelliSense which, again, is a great help for the HTML coder a more useful feature is Visual Studio's ability to change the matching tag automatically. How often have you changed an <h2> tag to, say, <h3> and then forgotten to change the corresponding </h2> tag? Now this is done automatically, which is clever.

One useful addition that helps when working on a design is the new colour picker, which pops up when you type "color:#" into your style sheet. Not only does a palette of colours appear, but if you expand this you'll find an eyedropper control that lets you select a colour from anywhere on the computer screen, not only within Visual Studio. This is a boon for the designer, but it makes it all the more irritating that there isn't a proper preview in the design mode of the UI.

Other  
 
Most View
Guilt - Expense Summary
The Architecture Of Cloud Foundry
Top 10 Laptops - Q1 2013
Microsoft Lync Server 2010 : Planning for Internal Non-Voice Deployment - Planning for IM
Windows Server 2008 R2 Powershell Cmdlets (part 1) - Active Directory cmdlets
Kingston HyperX Red 8GB DDR3-1600
Introducing HTML5 - Creating with Tags : An Overview
Programming the iPhone User : UX Anti-Patterns - Bullhorns
Windows 8 Hybrids, Tablets And Laptops (Part 7) : Acer Aspire S7, Sony VAIO T13
Sony NEX-6 Mirrorless Camera Review (Part 12)
Top 10
Windows Server 2012 : Planning, implementing, and managing Group Policy (part 9) - Configuring WMI filtering
Windows Server 2012 : Planning, implementing, and managing Group Policy (part 8) - Managing GPO links, Configuring security filtering
Windows Server 2012 : Planning, implementing, and managing Group Policy (part 7) - Viewing infrastructure status, Creating GPOs
Windows Server 2012 : Planning, implementing, and managing Group Policy (part 6) - Advanced Audit Policy Configuration
Windows Server 2012 : Planning, implementing, and managing Group Policy (part 5) - User Rights Assignment, Security Options
Windows Server 2012 : Planning, implementing, and managing Group Policy (part 4) - Refreshing Group Policy
Windows Server 2012 : Planning, implementing, and managing Group Policy (part 3) - Configuring a central store, Using Starter GPOs
Windows Server 2012 : Planning, implementing, and managing Group Policy (part 2) - Group Policy and Active Directory design
Windows Server 2012 : Planning, implementing, and managing Group Policy (part 1) - Understanding policies vs. preferences
Windows 8 : Monitoring, optimizing, and troubleshooting system health and performance (part 5) - Monitoring system resources by using Performance Monitor