Windows 8 Consumer Preview and Visual Studio 11 Beta – What’s New (Part 1/11)
Long awaited Windows 8 Consumer Preview (Win8 CP) just released!
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:
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.
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:
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:
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:
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:
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 50x50 (was 56x56), new splash screen size is 620x300 (old was 624x304), 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,