10

I just did a fresh install of visual studio community edition. When I start a new project and choose 'Blank App (Universal Windows)' I get this error during project creation:

Package Installation Error Could not add all required packages to the project. The following packages failed to install from 'C:\Program Files (x86)\Microsoft SDKs\NETCoreSDK': Microsoft.NetCore.UniversalWindowsPlatform.5.0.0: Package restore failed. Rolling back package changes for 'AppTest'

Any ideas what the cause of this error can be?

I installed all the Universal Windows App Development Tools: - Tools (1.3.2) and Windows 10 SDK (10.0.10586) - Emulators for Windows 10 Mobile (10.0.10586) - Windows 10 SDK (10.0.10240).

What am i missing. How can I solve this issue?

Stefan H
  • 1,063
  • 1
  • 10
  • 18
  • *"Rolling back package **chnages**"* - is this copied verbatim from the output pane/error dialog, or did you transcribe this? Please make sure to post the **exact** error message always. In case this is a dialog, you can copy-paste it using the standard [Ctrl]+C/[Ctrl]+V keyboard shortcuts. – IInspectable May 23 '16 at 14:29
  • Thanks. That was a type mismatch indeed – Stefan H May 23 '16 at 14:37
  • I didn't encounter this problem before, but after a quick search, I found a similar question [here](https://social.msdn.microsoft.com/Forums/vstudio/en-US/858ed562-f563-4b64-838d-4b6870986e4b/universal-apps-windows-10-error?forum=visualstudiogeneral). Hope it helps. – Jay Zuo May 26 '16 at 02:39
  • I just encountered this problem. I have an solution and want to add a Project named ```TestApp```. This results in the described problems. This is reproducable. Deleting the project and recreating it leads to the same error. Including the same steps in other solutions. However using another name for the Project _fixes_ the problem. I just can't use the name ```TestApp```. This is odd. – lokimidgard Jun 21 '16 at 09:18

8 Answers8

8

Sometimes nuget fails to install the UniversalWindowsPlatform package. Search for "Microsoft.NETCore.UniversalWindowsPlatform" nuget package and install it.

Ateik
  • 2,458
  • 4
  • 39
  • 59
6

This is not an answer, I have the exact same issue and I have found other people with the same issue on the web, no one has come up with a solution yet. This is upon creation of 'any' UWP project type, blank, templated, VB, C#. This dialog pops up: dialog error

I have already found and tried all of the steps mentioned by Jay Zuo. This is actually for a slightly different issue, the dialog is exactly the same apart from the bit, where we have ': Package restore failed.' They are getting ': Solution is not opened or not saved' None of the steps on that post help resolve this issue. I have tried restoring VS, Reinstalling the Windows 10 SDK, resetting VS using the various options to reset user data, environment etc, made sure the path to the SDK files exists. Nothing has worked and my VS2015 Community is utterly useless right now for working on UWP projects. This is a new Windows 10 / VS install (VS on insider fast PC has no issue at all but I need this one on production build).

I am posting as an answer as I do not have enough points to comment but starting a new thread seems daft as this is the exact same issue, I just want to add more detail to it.

BGTurner
  • 307
  • 3
  • 9
3

I had the same probem after a clean install of OS/Updates/VS 2015 Update 3 + Xamarin update. I created a Universal 'Blank XAML App (Xamarin Forms Portable)' During creation I received same error.

In the Nuget Package Manager Console pick AppX.UWP, then run:

Install-Package Microsoft.NETCore.UniversalWindowsPlatform 

Restart VS and create a new project, error does not come back.

jlo-gmail
  • 4,453
  • 3
  • 37
  • 64
2

So after much back and forth between myself and an MS rep on their forums I did actually manage to resolve this. The forum link is here

I did actually need to reset my VS installation to try and get a clean install. Then the actual error reared its head. In my case it was Nuget caching corrupt packages (these are not cleaned by a VS reinstall).

The link that helped me resolve it in the end can be found here on Stack Overflow

Community
  • 1
  • 1
BGTurner
  • 307
  • 3
  • 9
  • This did it for me. I didn't have to go through and update any packages like the other answers. Those probably work as well because it gets rid of whatever was corrupt in the cache. I think this solution should be picked since it could solve a broader list of issues with nuget. It's good to have this in my belt of troubleshooting tactics for future use. – Ebsan Mar 05 '17 at 21:01
1

What helped me was to update the UniversalWindowsPlatform package in nuget to 5.1.0. Then all went smoothly the next time I created UWP project.

Petr
  • 11
  • 1
1

Upgrading the package Microsoft.NetCore.UniversalWindowsPlatform.5.2.2 worked for me...

CD Smith
  • 11
  • 1
  • For me it was on the contrary - Xamarin template created a project which referenced Microsoft.NetCore.UniversalWindowsPlatform.5.2.x (where x was some older version) but I had installed Microsoft.NetCore.UniversalWindowsPlatform.5.2.2, so I had to downgrade. – JustAMartin Sep 01 '16 at 15:56
0

After facing a similar problem with Microsoft.NetCore.UniversalWindowsPlatform.5.2.3. I found a solution which might help someone. I navigated to my ProgramData\Microsoft\VisualStudio\Packages\Microsoft.Net.CoreUWP,version=1.0.4 and ran the netfx_NETCoreUWP.exe. It did resolve my problem

Gnyasha
  • 658
  • 11
  • 19
0

Just as a reference...

My NugetPackage "'Microsoft.NETCore.UniversalWindowsPlatform" disappeared from my project references. It showed up as installed in NuGet. I uninstalled and re-installed without success. I restarted Visual Studio and re-installed and the package reappeared :-) !

Eric Ouellet
  • 10,996
  • 11
  • 84
  • 119