Your project file doesn't list 'win10' as a "RuntimeIdentifier"... error when running Xamarin UWP project
Asked Answered
J

6

9

Here is the full error:

Your project file doesn't list 'win10' as a "RuntimeIdentifier". You should add 'win10' to the "RuntimeIdentifiers" property in your project file and then re-run NuGet restore.

I opened up the csproj file in a text editor but I don't see any RuntimeIdentifiers property so I don't know where to add "win10"...

Jack answered 31/7, 2019 at 13:55 Comment(0)
J
-3

What I had to do is:

  1. Create a brand new Xamarin app with a UWP project.
  2. Copy the contents of my original UWP project's csproj file into a text editor
  3. Copy the contents of the new UWP project file into the original.
  4. Replace anything like project names and GUIDs that got overwritten with the original values.
Jack answered 31/7, 2019 at 19:13 Comment(4)
can you use a diff tool (WinMerge) to show the difference to your original file?Courtmartial
Yes, I did that.Jack
and what is now different between non working and working version?Courtmartial
what was the fix? as in what was in the diff? everybody is saying nuke the bin and obj.. but that apparently wasnt the answer.. sorry but -1 for not giving us the details... we need the details please. If you update you will get upvote backSkier
F
17

You can try to delete the bin and obj folders in the project, then restart VS and rebuild the project.

Feints answered 31/7, 2019 at 15:7 Comment(0)
C
11

Unload the .csproj, open it in editor and add this:

 <PropertyGroup>
    <RuntimeIdentifiers>win10-arm;win10-arm-aot;win10-arm64-aot;win10-x86;win10-x86-aot;win10-x64;win10-x64-aot</RuntimeIdentifiers>
 </PropertyGroup>

Save the csproj, reload it in VS and run nuget restore.

Courtmartial answered 31/7, 2019 at 14:39 Comment(6)
Nope, I still get the same error. If I add "win10" to the RuntimeIdentifiers, I get an error saying I need .NET Framework...Jack
try to delete the obj folder with the project.assets.json and the PROJECTNAME.csproj.nuget files and let VS regenerate everything.Courtmartial
I deleted the bin and obj folders and built the project again, but I still get this error. Are the project.assets.json and PROJECTNAME.csproj.nuget files located outside of obj?Jack
they are located in obj folders. Here are some details about the file: kimsereyblog.blogspot.com/2018/08/…Courtmartial
After editing your csproj file as indicated in this answer, right-click on the solution name and choose "Restore NuGet Packages". Then do your build and you shouldn't get the error message.Leucippus
It definitely fixed the case for me. Thank you very MuchKatabasis
R
6

same issue on my end. I was able to fix it by specifying platform target under the project's properties>Build. When I looked at it it didn't have anything selected.

Remscheid answered 28/2, 2020 at 22:8 Comment(0)
M
1

Try changing the CPU architecture. The option on toolbar that may say "Any CPU", if then please change it to your preferred architecture (e.g. I use x64, use x86)

See the image for exact location of the option

Multicolored answered 6/8, 2021 at 3:48 Comment(0)
U
0

I found and fixed a very similar issue with a C# XAML app that showed the same error after adding arm64 target platform. The fix was to upgrade the NuGet PackageReference for Microsoft.NETCore.UniversalWindowsPlatform to be above version 6.2.x Restore NuGets and it will then build.

Unbolt answered 23/11, 2020 at 14:36 Comment(0)
J
-3

What I had to do is:

  1. Create a brand new Xamarin app with a UWP project.
  2. Copy the contents of my original UWP project's csproj file into a text editor
  3. Copy the contents of the new UWP project file into the original.
  4. Replace anything like project names and GUIDs that got overwritten with the original values.
Jack answered 31/7, 2019 at 19:13 Comment(4)
can you use a diff tool (WinMerge) to show the difference to your original file?Courtmartial
Yes, I did that.Jack
and what is now different between non working and working version?Courtmartial
what was the fix? as in what was in the diff? everybody is saying nuke the bin and obj.. but that apparently wasnt the answer.. sorry but -1 for not giving us the details... we need the details please. If you update you will get upvote backSkier

© 2022 - 2024 — McMap. All rights reserved.