Windows 8 Consumer Preview and Visual Studio 11 Beta – What’s New (Part 1/11)

February 29, 2012

Long awaited Windows 8 Consumer Preview (Win8 CP) just released!

image

It is not come alone, but accompanied with Visual Studio 11 Beta (VS11)! Both products available for download. The links are:

Win8 CP download is available here.

Visual Studio 11 Express Beta for Windows 8 download available here.

So what’s new for developers?

First think you will meet right after installing VS11 is facelift. Compare – VS2010 & VS11:

image

image

VS11 got Metro-ish face lift! The icons are flat and grey, windows got flat look and feel with grey title, even breakpoint marker (red dot) was flattened. Despite the fact I loved Win8 Metro main screen, my first reaction was “%@X&*@%$#@$@!” and I have to admit I was wrong. Now, after using it for quite some time I absolutely love it!

In next days you will see great many articles and blog posts discussing new features of Win8 CP and the VS11; I will focus on practical part part – how to take your //BUILD DP application run in Win8 CP.

Disclaimer: I love XAML and C#, thus all my posts will be focused only on those technologies of Win8 Metro development. If you are looking for XAML/C++ or HTML/JavaScript stuff, you should refer to some other wonderful blogs.

Let’s see how to migrate you BUILD DP timeframe app to Beta. Just opening the application’s solution file with VS11 Beta will not work and you will be getting this kind of experience:

image

With the following problem in Output window:

C:\Users\Alex\Downloads\File access sample\C#\FileAccessSample.csproj : error  : The imported project "C:\Program Files (x86)\MSBuild\Microsoft\WindowsXaml\v1.0\Microsoft.Windows.UI.Xaml.CSharp.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.  C:\Users\Alex\Downloads\File access sample\C#\FileAccessSample.csproj

While it is possible to open csproj file, change the “v1.0” to”v11.0” in file path and reload the project in some cases this will render following some of the following errors:

image or image

The best approach to migrate you existing application would be to start brand new “Blank Application” from Windows Metro Style templates and start pulling in your resources, XAML and code files:

image

After rebuilding your project structure, try to compile you application. It will not compile: the biggest change impacting your work will be accommodating the naming changes in Windows.UI.ViewManagement.ApplicationLayout. All names referencing “layout” were changed to “view”. Enumerations for ApplicationViewState now reflect different orientations, so ApplicationViewState.FullScreen was split up into FullScreenLandscape and FullScreenPortrait which you will have to accommodate in your code.

The event handlers for View state changes have changed and need to be migrated:

Windows.UI.ViewManagement.ApplicationView.GetForCurrentView().ViewStateChanged +=        
    new TypedEventHandler<Windows.UI.ViewManagement.ApplicationView, Windows.UI.ViewManagement.ApplicationViewStateChangedEventArgs>(MainPage_ViewStateChanged);

Also the handler function signature changed:

void MainPage_ViewStateChanged(Windows.UI.ViewManagement.ApplicationView sender, Windows.UI.ViewManagement.ApplicationViewStateChangedEventArgs args)
{
    //...
}

This is a common part for all applications, but this is only the beginning. After dealing with this part you are expected to change/fix breaking changes in WinRT APIs – the amount of those changes and possible solution depends entirely on your application’s functionality and used APIs.

Last, but not least, you must provide new resized graphics for application package such as package logo size is 50×50 (was 56×56), new splash screen size is 620×300 (old was 624×304), badge (if your application uses it) and maybe some others.

For complete list of breaking changes, please refer to the documentation here.

That’s it for now. In next posts I will show few new (or changed) APIs in Win8 CP. Here are the next planned posts in this series (in no specific order):

1. What’s New – this post

2. Proximity – in this post I will show how to use near field communication (NFC) to transmit information between NFC-enabled devices

3. Sharing data – in this post I will overview how to share the data from your application (“Share source”). Also, I will describe how to build simplest “Share target” application which helps to debug you share source app (and was really helpful for me, since at the time I wrote this series the marketplace apps were not available and I had no app to share my data with)

4. Settings – in this post I will overview how to use the settings charm and integrate your app settings into it

5. Local and roaming data – in this post I will overview how to save the data for your application and how to use Win8 CP built-in settings sync functionality to sync your app’s settings

6. Sensors – in this post I will overview working with some sensors. Since may posts will overview using accelerometer, inclinometer and other “orientation-related” sensors (easier to bind their data to input and showcase) I decided to overview using relatively exotic one- the light sensor and how to use its data in application.

7. Licensing (Trial/Full application) and In-App purchases – in this post I will overview the different modes of the application, the products which developer can supply for in-app usage and how to debug those features before your application is published.

8. Location Service – in this post I will overview how to use location information in your app

9. Popups – in this post I will show how to use new kind of “Message Box” in Win8 CP Metro apps.

10. Live tiles, toasts and badges and Push Notifications – in this post I will overview how to keep interacting with your user, even when you application is not running anymore. Also I will touch how to deliver push notifications to your application (which used to update tiles, toasts and badges as described in “Live tiles, toasts and badges” post)

11. PLM and Custom Splash Screen – in this post I will overview product lifecycle management and custom splash screen

If you are still thinking about downloading and trying Win8 CP and VS11 Beta – think no more! Just go and download!

Stay tuned for more posts to come,

Alex

Add comment
facebook linkedin twitter email

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

3 comments

  1. RipleyMarch 9, 2012 ב 10:03

    Could you help to clarify the capability difference between CP and DP? Can one completely replace DP with CP in order to develop win8 applications?

    Reply
  2. Alex GoleshMarch 10, 2012 ב 2:54

    CP is a consumer preview release at Feb. 29 2012. DP is a developer preview released during BUILD conference back in Sep. 2011.
    Yes, you should replace DP with CP.

    Alex

    Reply
  3. MichelJune 22, 2012 ב 1:31

    Notably it includes a set of JavaScript lirbaries to enable developers to write MapReduce jobs with JavaScript. In addition to support for Node.js, Microsoft has been pushing HTML5, JavaScript and CSS as a cross-platform development solution, instead of its own Silverlight stack. Microsoft has gone as far as to emphasize JavaScript et al as the development stack for its Metro framework on Windows 8.

    Reply