NiyaShy / XB1ControllerBatteryIndicator

A tray application that shows a battery indicator for an Xbox-ish controller and gives a notification when the battery level drops to (almost) empty.
GNU General Public License v2.0
715 stars 51 forks source link

References to windows.foundation, windows.ui and windows.data missing (Visual Studio 2019) #28

Closed Simzy closed 5 years ago

Simzy commented 5 years ago

the referenced component windows.foundation could not be found, same goes for windows.ui and windows.data

Am i missing something as i wanted to build a version using different icons for myself but it refuses to compile without those.

NiyaShy commented 5 years ago

Hey, I can't say where exactly those come from, so I can only ask about what you currently have and compare it to what I use. Are you running on Windows 10 and use Visual Studio (community) 2017? The only workload package that you should need is .NET desktop development.

Simzy commented 5 years ago

Windows 10 1903 and VS community 2019, all clean install with .NET desktop development but the notifications are the same

NiyaShy commented 5 years ago

That's... weird. Can you cross-check under project -> add reference, there you should have the side bar entry Windows that includes the entries Data, Foundation and UI.

Simzy commented 5 years ago

https://puu.sh/DBhDy/f66cc5077a.png

NiyaShy commented 5 years ago

OK, I think we're getting there. Can't check the exact name since I'm not on my main machine due to the warm weather, but I guess it might be necessary to install the windows 10 SDK package for the references to become available.

Simzy commented 5 years ago

Ive already got all the SDKs which is why its confusing me so much

NiyaShy commented 5 years ago

Sorry for the delay, it cooled down a bit today so I'm back on my main machine. According to the VS installer, the only packages I have are:

And apparently I also have the Win10 SDK 10.0.14393.33 as a leftover from Visual Studio 2015...

When you have all of them installed, the only real difference would be that you already use VS 2019 while I'm still on 2017.

Simzy commented 5 years ago

Same files, even using 2017 is still the same issue. What are the properties for your version of windows.data , here is what mine shows https://puu.sh/DCrHH/59be3043f0.png

Simzy commented 5 years ago

Going through the code, its all pointing back to toast notifications, if i remove those lines of code then it compiles fine.

NiyaShy commented 5 years ago

https://i.imgur.com/Fh2F1a4.png The referenced winmd files are all under C:\Windows\System32\WinMetadata.

Simzy commented 5 years ago

I have finally figured out what the hell has been going on, there is a bug in 1903 with Visual Studio 2017 (i removed 2019) where it cant actually see the WinMetadata folder, so i copied the contents to a different location (to make things easier i copied them to C:\Program Files (x86)\Microsoft SDKs\Windows Kits\10) and then i add them in as a reference using the browse option and selected them all to help.

NiyaShy commented 5 years ago

Good to know and also another reassurance for me that it's a good idea to wait with new Win10 releases for several months (praise be to Win10 pro). So I guess it finally works now?

Simzy commented 5 years ago

yeah i can get it to build, until i start changing namespaces like the localization for the different languages. Wanted to be able to remove the extra languages and the update section to make it easier for my idea on a redesign on the context menu i want to test.

NiyaShy commented 5 years ago

Just wanted to add my 2 cents to this since I ran into the issue myself today after uninstalling VS 2017...

As you said, VS 2019 can't see/access C:\Windows\System32\WinMetadata and due to that the references are missing. This could be a bug, but I also found hints that it might be intended since the WinMetadata folder is apparently meant to be only used by windows itself.

Anyway, copying the folder somewhere else and manually adding references to Foundation, UI and Data fixes it.