0
votes

I'm trying to install VS2015 Community in my PC. When I install everything at the end the installer gives to me the following message:

Windows 10 SDK(10.0.10240) The installer failed. Fatal error during installation. Error code: -2147023293

I've tried to install, reinstall, update but anything changed. The only consequence that I can see is that when I create a new Xamarin solution, when I run the UWP project using Local Machine as target it starts, but then I obtain this exception message.

exception

If I run the application from the Mobile emulator, it starts without problems.

Somewhere (sorry, I forgot the source) I've read that I should be sure to add following references for the project:

  • Windows Desktop Extensions for the UWP
  • Windows Mobile Extensions for the UWP

But I've only the first one, not the second. Maybe it's related to the installation issue?

I'm new to Xamarin and UWP, but UWP should be run to both Mobile devices and desktops, so why I have this behaviour? and what I can try to solve the installation problem that's probably related to this?

So, at the end, what I can try in order to fix the installation and allows the xamarin UWP project to run correctly in the local machine?

1
I think you should VS installation, not Xamarin. If VS installs correcly Xamarin should be ok. Is your PC Windows 10? may be that will help developer.microsoft.com/en-us/windows/downloads/windows-10-sdkYuri S
I've already tried it. It says me that the SDK is already installed. If I uninstall it and then install this one nothing changes.Jepessen

1 Answers

1
votes

If I run the application from the Mobile emulator, it starts without problems.

According to your error message, it seems you are using StatusBar in your project.

While using StatusBar, please note that this is not a Universal API, this class can be only used in Mobile Device. Because status bar only exists in Mobile devices, there is no such thing in desktop, table or IoT devices. So if you use this class on Local Machine, you will get an error, but in Mobile Emulator, it can work without problems.

For more info, please see Requirements section of StatusBar.

Usually, when using StatusBar, we would use it with Runtime API check like following:

Windows.UI.ViewManagement.StatusBar statusBar = null;
if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar"))
{
    statusBar = Windows.UI.ViewManagement.StatusBar.GetForCurrentView();
}

if (statusBar != null)
{
    //TODO
}

On Local Machine, as there is no StatusBar, ApiInformation.IsTypePresent method will return false. This will help us avoid the error. For more info, please see Write adaptive code.

But I've only the first one, not the second. Maybe it's related to the installation issue?

I'm not sure why you can't find the Windows Mobile Extensions for the UWP. But if you have used StatusBar and can build and run your project in Mobile Emulator, then you must have referenced Windows Mobile Extensions for the UWP. Without this extension, we can't use StatusBar and the build will fail.

Depending on the SDK you've installed, you can find following extensions in Reference Manager (Right click "References" in your project and then select "Add Reference""Universal Windows""Extensions").
enter image description here

I'd suggest you create a new Blank App (Universal Windows) project with Visual Studio to see if you have both the Desktop Extensions and Mobile Extensions. If you still have problem in new Blank App, I'd suggest you use Visual Studio Uninstaller to uninstall Visual Studio completely and also check the Control Panel to make sure you have uninstall all related stuffs like the SDKs. Then you can try to reinstall Visual Studio to see if it works.