Windows 10 Development: Upgrading from Preview SDK to Release

This post is part of the series: Developing Windows 10 Apps


Before diving into the main parts of our series, there may be some of you (like me!) that were already building apps with the preview SDK for Windows 10. If you attempt to open a preview solution with the final version of the SDK installed, you will very likely have issues (as I did!). In this quick bonus post, I’ll cover just a few of the issues I had to fix to get my project updated and running with the latest releases of both Windows 10 and Visual Studio 2015.

Note that your mileage may vary as every project is different, but this is what worked for me, and hopefully it can help others facing similar issues.

Project Error: Update Required

If you did what I did and uninstalled the previous preview SDK before installing the final version, the first issue you’re likely to face is the Solution Explorer unloading your project with the message: update required.

Visual-Studio-Windows-10-Update-Required

If you attempt to reload the project in the solution explorer, you’ll get a dialog message confirming that you no longer have the version of the SDK required to open the project:

Visual-Studio-Windows-10-SDK-Not-Installed-300x164

Now, even if I wanted to install the previous SDK again (which I don’t!) the link in the dialog no longer appears to be valid as it takes you instead to the Microsoft home page. This isn’t unexpected as the preview SDKs are clearly obsolete.

Another option would be to simply create a new project in Visual Studio, which would of course use the final installed SDK to generate the project, ensuring it will run on the release version of Windows.

Windows-10-App-Visual-Studio-Template

However, the Falafel2Go project I’m working on has gone through a lot of changes, and is already checked into our Git repo, and I didn’t want to go through the entire process of rebuilding the project from scratch.

Instead, I decided to create a new blank project, and compare its contents to my solution, updating mine to match the final version as much as possible. Here were the changes required to get my project running.

Update the Windows Project File (csproj)

Comparing my C# project file (csproj) with the one in the blank project revealed several differences, the key of which were two properties for TargetPlatformVersion and TargetPlatformMinVersion. While my project file had the preview SDK version:

<TargetPlatformVersion>10.0.10166.0</TargetPlatformVersion><TargetPlatformMinVersion>10.0.10166.0</TargetPlatformMinVersion>

The Blank app referenced the release version of the SDK:

<TargetPlatformVersion>10.0.10240.0</TargetPlatformVersion><TargetPlatformMinVersion>10.0.10240.0</TargetPlatformMinVersion>

Saving this change will let Visual Studio know you’re using the latest installed SDK, and at this point you would be able to reload the project in the Solution Explorer, but WAIT! Another discrepancy I only painfully later discovered is the fact that the generated app has a reference to the project.json file and associated project.lock.json file. These are special files that list all the dependencies and frameworks that a project references:

  <ItemGroup>
<!-- A reference to the entire .Net Framework and Windows SDK are automatically included -->
<Content Include="ApplicationInsights.config"><CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<None Include="project.json" />
</ItemGroup>

Do not miss this one! Copy it to the project folder and add it as a reference to the project file. Although I now slightly recall hearing about this file before, at the time I assumed it was a reference sample data, and thus did not include it when updating my .csproj file. This resulted in a massive list of framework errors, such as:

  • Predefined type 'System.Object' is not defined or imported

  • Predefined type 'System.Void' is not defined or imported

  • The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'

  • The type or namespace name 'Runtime' does not exist in the namespace 'System' (are you missing an assembly reference?)

Visual-Studio-Windows-10-Framework-Errors-300x141

I was clearly referencing the correct framework in the project, and any error list that extensive has to be a configuration issue (I would hope!), and after painstakingly inspecting every file in the project I finally realized that I’d skipped a critical section.

So again, don’t skip this the reference to project.json and the project.lock.json files when updating your .csproj file!

Finally, you also want to make sure you update the definitions for the Debug Constants. While the preview used “WINDOWS_UAP” the release SDK appears to expect “WINDOWS_UWP”:

<DefineConstants>DEBUG;TRACE;NETFX\_CORE;WINDOWS\_UWP</DefineConstants>

At last I was able to correctly open the project in Visual Studio, but even after updating the reference to project.json and project.lock.json you might still have the crazy list of errors I saw. This is because the project is still using the preview bits for all of the references.

But before we can update them, we have to also update the manifest to reference the release SDK as well.

Update the App Manifest File (Package.appxmanifest)

Sure enough, while my app manifest file had a reference to a specific SDK version:

  <Dependencies>
    <TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.10069.0" MaxVersionTested="10.0.10069.0" />
  </Dependencies>

The Blank App simply referenced Windows 10:

  <Dependencies>    <TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.0.0" MaxVersionTested="10.0.0.0" />  </Dependencies>

I updated it to match and proceed to update the NuGet Packages.

Update NuGet Packages, Remove Preview References

Next I proceeded to upgrade all the NugetPackages in my project to the latest versions with the nifty new Nuget Explorer:

Visual-Studio-Windows-10-Nuget-Explorer-300x172

Although my project did have the correct reference to the Windows platform, I noticed that the Blank App had an additional Nuget Package Microsoft.NETCore.UniversalWindowsPlatform installed, and apparently includes ALL the goodies and dependencies of the platform, so I added it to my project as well.

Visual-Studio-Windows-10-NETCore-UniversalWindowsPlatform-296x300

Note: if you didn’t add the project.json reference, this step will probably NOT work for you as it certainly didn’t for me, give you the error message:

Could not install package 'Microsoft.NETCore.Platforms 1.0.0'. You are trying to install this package into a project that targets '.NETCore,Version=v5.0', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.

This is especially frustrating since the project was clearly configured for .NET 5 and resulted in a lot of wasted time… So just to drive the point home one last time: don’t forget to add the project.json and project.lock.json files!

If all else fails, remove EVERYTHING via NuGet, and start with the UniversalWindowsPlatform package, adding your packages one by one until you’re back where you need to be.

Finally, when you’re done, you may end up with duplicate references to some libraries from the older SDK and NuGet packages, as well as references to libraries that have been rolled into the UniversalPlatformLibrary:

Visual-Studio-Windows-10-Duplicate-Framework-References-169x300

This will result in errors like:

The type 'Uri' exists in both 'System.Private.Uri, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' and 'System.Runtime, Version=4.0.20.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'

Simply remove the extra references in the Solution Explorer, and at long last you should be good to go!

Visual-Studio-Windows-10-Successful-Build-300x88

Wrapping Up and Next Steps

Depending on your project, the steps outlined here may not get you 100% updated to the release SDK, but hopefully sharing my experience will help others who have invested considerable development time in the Preview SDK to avoid having to start fresh with the release.

Now that we’ve got our demo project updated and ready to go we can dive into the good stuff about Windows 10 development. Stay tuned for more, and as always, I hope this was helpful and thanks for reading!

Enjoyed this post and/or found it useful?
SelArom Dot Net Profile Image
SelAromDotNet

Josh loves all things Microsoft and Windows, and develops solutions for Web, Desktop and Mobile using the .NET Framework, Azure, UWP and everything else in the Microsoft Stack.

His other passion is music, and in his spare time Josh spins and produces electronic music under the name DJ SelArom.



Scroll to top