There was a bug uncovered in Unity recently where it fails to read Windows 10 SDK version correctly if this new SDK is installed. Due to this bug, Unity will generate incorrect project files when targeting Windows Store with Windows 10 SDK, which Visual Studio will not be able to open.
We’re going to release a patch to fix this bug, but until we do, please do not download and install this SDK if you wish to build for Windows 10. I’ll notify in this thread when the fix is released.
The older Windows 10 SDK which works with Unity (version 10.0.10240.0) can be downloaded here:
UPDATE: Fix is now available in 5.2.3p3 and 5.3.1f1 releases.
via Visual Studio 2015 Installer, I was able to remove 10.0.10586.0 (10.0.10240.0 was still available), and unfortunately now Unity is unable to compile as it continues to look for 10.0.10586.0 :
Finished compile Library/ScriptAssemblies/Assembly-CSharp-firstpass.dll
Compilation failed because the compiler couldn’t be executed!
(Filename: Line: 57396624)
DisplayProgressNotification: Build Failed
Error building Player because scripts had compiler errors
… I’ll re-apply 10.0.10586.0 and do the .csproj edit to see if that allows me to atleast do the exports from Unity and builds in Visual Studio.
No, my post is correct. Unity adds an extra “.0” to the version number. Visual studio gets confused, chaos ensues.
The workaround is possible, but it’s ugly. You’ll have to do it each time you build from Unity if you use C# projects and you’ll also have to do it each time you build to a new location.
ok, after much ‘to-do’ … replacing 10586 with 10240 ‘and’ updating the references in the project for “Windows Mobile Extensions for UWP…” allows the project to open and build in Visual Studio (of course using older SDK)
otherwise, updating to 10.0.10586.0 and removing just the extra .0 I get the following:
The project requires a platform SDK (UAP, Version=10.0.10586.0) that is not installed.
This fixed most of my project for me. Combined with this line which also had an extra zero I was able to build. <SDKReference Include="WindowsMobile, Version=10.0.10586.0.0">Changed to
Hey guys, I wrote a quick fix. This script should be put in an Editor folder to prevent build errors. I put mine in Assets/Editor/Win10SdkFix.cs
Code is here:
/* Garth: The Windows 10 SDK was updated recently, which broke Unity builds.
* It came down to a few extra ".0" in an XML file someplace.
* Instead of manually changing it, let's just code Unity to do it for us.
*/
#if UNITY_WSA
using UnityEngine;
using UnityEditor;
using UnityEditor.Callbacks;
using System.IO;
public class Win10SdkFix
{
[PostProcessBuild(1)]
public static void OnPostprocessBuild(BuildTarget target, string pathToBuiltProject)
{
string name = PlayerSettings.productName;
string pathToXml = pathToBuiltProject + "/" + name + "/" + name + ".csproj";
Debug.Log("Attempting to fix bad SDK version at " + pathToXml);
if (!File.Exists(pathToXml))
{
Debug.Log("Could not find " + name + ".csproj file to fix.");
return;
}
string xml = File.ReadAllText(pathToXml);
if (!xml.Contains(BadString))
{
Debug.LogWarning("Could not find bad string in " + name + ".csproj file. Have you updated Unity? You can remove this script.");
}
else
{
xml = xml.Replace(BadString, GoodString);
File.WriteAllText(pathToXml, xml);
Debug.Log("Fixed sdk version string in " + name + ".csproj file.");
}
}
const string BadString = "10.0.10586.0.0";
const string GoodString = "10.0.10586.0";
}
#endif
Great work @GarthSmith Could probably enhance that by also testing the buildtarget, so it’s only evaluated for the Win10 builds. Presently it will fire for all platforms.
What bad luck. Just lost 3 hours due to this glad to know there is a potential fix on its way. Thanks for the script Garth, seems to have made a difference