Your project is not referencing the "UAP,Version=v10.0.10240" framework

Viewed 5677

I am using Visual Studio Community Edition 2017 and trying to create a UWP application.

I get the following error

Your project is not referencing the "UAP,Version=v10.0.10240" framework. Add a reference to "UAP,Version=v10.0.10240" in the "frameworks" section of your project.json, and then re-run NuGet restore.

9 Answers

I recently ran across this same issue when updating the target framework. The issue turned out to be the Nuget Restore task in my VSTS Build definition needed to be updated to the latest version (2.*). Once I did that, the builds worked as expected.

I agree with Jeff. Ken Not sure if you should be giving any answers with this kind of attitude.

The error message is misleading there is not project.json at least you cannot see it in the Visual Studio explorer.

I had the same issue and have min and target version set to the same number but it would not build.

The fix was to make sure in Nuget package manager setting to tick checkbox 'Allow Nuget to download missing packages' and the one below it as well and rebuild the project.

This is a pretty weird mistake, but what worked for me :

1st Solution:
1 - Change your project target to "10.0.10586" (or up)
2 - Make a clean / nuget restore / rebuild
3 - Return the project target to the "10.0.10240"
4 - Make a clean / nuget restore / rebuild

Do not ask me why, but it worked :)

2nd Solution:
If you use a repository with Tortoise, try making a CLEANUP

I had an old Backup folder in my project that contained a project.json. Looks like it might have been from an earlier upgrade. I deleted Backup and got a good build.

This happens in exactly this manner, if projects were generated in the year 2017 in the phase where MS changed to project.json and then decided against it. I tried several solutions (and yeah, Ken White is so wrong!) and the cleanest way was to really build up a new clean project in the lastest and up to date version of Visual Studio (VS2015 did not work sustainable) and just copy over the old project content which is just a few minutes work. This will save you a lot of headaches especially working in a larger team!

I tried the above solutions but nothing worked. I had to backup and remove the UWP project and recreate it from scratch.

I tried a couple of solutions.

Solution 1

Open the solution from Windows explorer and search for project.json files. Open all of them (If you have multiple) and make sure the required framework versions are there. I frequently switch between build 10240 and 17763 and I get this error frequently. (I switch between git branches that target different frameworks of UWP) So instead of adding the exact version I just added only the 10.0 part like this.

"frameworks": {
  "uap10.0": {}
},

Now if your project.json files are ok, search for project.lock.json files. If you have one or more of those, delete them.

Now clean your solution

Close VS

Delete all the bin and obj folders.

Reopen the VS and try to run the app.

Solution 2:

Go to project properties

Change the minimum and target version to something else and do a clean build. Then put the actual versions and build again.

enter image description here

enter image description here

Related