Windows 10 For Developers 4 of N: Upgrading to Visual Studio 2015RC

Here it is. After some weeks full of news with the //Build 2015 and Ignite 2015 conferences, it is time to start again talking about all the new things Windows 10 can bring to us, developers.

But first, let's see the other articles in the series so you can have a look at them:
This, the fourth article in the series, will help you transition from Visual Studio CTPX to Visual Studio 2015 RC. Every time you work with pre-release software you are exposed to some breaking changes that can occur between versions. This is the case of the transition to Visual Studio 2015 Release Candidate. The old Windows universal projects created with CTP versions will not load. If you try to open an old project in Visual Studio 2015 RC, the IDE will say you need an update to load the project:

 
This is a bit confusing, a newer IDE version needs an update to open an older project? No, in fact not. The problem is the UAP (Universal App platform) version of the project (10.0.10030.0) is not the same as the one supported now (10.0.10069.0) so Visual Studio thinks you are trying to open a newer one. Simply click OK.

The project will show in the Solution Explorer as "Update required". Right-click on the project name and select "Edit projectname.csproj" from the context menu. This will open the csproj file in XML format. Find the nodes "TargetPlatformVersion" and "TargetPlatformMinVersion". They will have a value different than 10.0.10069.0, change their value for the newer one 10.0.10069.0.

Save the changes, close the file and right-click again over the unloaded project, select "Reload nameoftheproject" from the context menu. This time the project will load fine and you should see your project completely.

But if you try to compile, multiple errors occur. The problem is, some insights references included by default has been updated and changed, so you need to manually do it. Right-click on your project References node and select "Manage NuGet packages" from the context menu. In the NuGet manager, be sure to filter by "Upgrade available" and to have checked "Include pre-release":

 
One of the results will be "Microsoft.ApplicationInsights". Select it and click Upgrade in the button at the right. Now in the Filter dropdown select "All" again and search for the following packages:
  • Microsoft.ApplicationInsights.PersistanceChannel
  • Microsoft.ApplicationInsights.WindowsApps 
Add both packages to your project.

You very nearly have your project working again. You need to update the applicationinsights.config file in your project with the new modules and configuration. The easy way to do this is simply open a new project and copy the content of the file to yours, or copy it from here:
  1. <?xml version="1.0" encoding="utf-8"?>  
  2. <ApplicationInsights xmlns="http://schemas.microsoft.com/ApplicationInsights/2013/Settings">  
  3.   <TelemetryModules>  
  4.     <Add Type="Microsoft.ApplicationInsights.Extensibility.Implementation.Tracing.DiagnosticsTelemetryModule, Microsoft.ApplicationInsights"/>  
  5.     <Add Type="Microsoft.ApplicationInsights.Extensibility.Windows.SessionTelemetryModule, Microsoft.ApplicationInsights.Extensibility.Windows"/>  
  6.     <Add Type="Microsoft.ApplicationInsights.Extensibility.Windows.PageViewTelemetryModule, Microsoft.ApplicationInsights.Extensibility.Windows"/>  
  7.     <Add Type="Microsoft.ApplicationInsights.Extensibility.Windows.UnhandledExceptionTelemetryModule, Microsoft.ApplicationInsights.Extensibility.Windows"/>  
  8.   </TelemetryModules>  
  9.   <TelemetryChannel Type="Microsoft.ApplicationInsights.Channel.PersistenceChannel, Microsoft.ApplicationInsights.PersistenceChannel"/>  
  10.   <ContextInitializers>  
  11.     <Add Type="Microsoft.ApplicationInsights.Extensibility.ComponentContextInitializer, Microsoft.ApplicationInsights"/>  
  12.     <Add Type="Microsoft.ApplicationInsights.Extensibility.DeviceContextInitializer, Microsoft.ApplicationInsights"/>  
  13.   </ContextInitializers>  
  14.   <TelemetryInitializers>  
  15.     <Add Type="Microsoft.ApplicationInsights.Extensibility.Windows.UserContextInitializer, Microsoft.ApplicationInsights.Extensibility.Windows"/>  
  16.   </TelemetryInitializers>  
  17. </ApplicationInsights>  
Unless you have some specific configuration, this will work for you.

At this point, your solution will compile and run without problems. But there will be two warnings about the temporary certificate of the app not being valid. There is no way to generate a new one (since the current version of the tools doesn't include the visual editor for appxmanifest) but you shouldn't have problems running your app, even if you delete the certificate.

And that's all! I used this method to upgrade all this series samples and all works perfectly now in Windows 10 10074 build and Visual Studio 2015 RC.
 
Soon we continue with more features of Windows 10,
 
Happy Coding! 

Up Next
    Ebook Download
    View all
    Learn
    View all
    Development, training and mentoring company focused on Mobile and Augmented reality