Resolved How to fix this? "The type or namespace name 'Windows' could not be found"

chairmanPC

Active member
Joined
Apr 19, 2021
Messages
38
Programming Experience
10+
The program will scan and exchange data with a bluetooth device. But right at the start, I get this "The type or namespace name 'Windows' could not be found" from the following two line in the code below.



C#:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.System;    //<--- offending line

using Windows.Devices.Bluetooth.Advertisement;    //<--- offending line

Did I miss a reference or something? I use VS 2019. How can I fix this?
 

Attachments

  • 1627877784686.png
    1627877784686.png
    91.3 KB · Views: 174
Solution
The program will scan and exchange data with a bluetooth device. But right at the start, I get this "The type or namespace name 'Windows' could not be found" from the following two line in the code below.



C#:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.System;    //<--- offending line

using Windows.Devices.Bluetooth.Advertisement;    //<--- offending line

Did I miss a reference or something? I use VS 2019. How can I fix this?
As I was going rounds on Google, I came across this site about C# Bluetooth communication in Japanese. The site said that we need the Microsoft.Windows.SDK.Contracts nuget package. I installed it and the error...
Did you reference an assembly that contains the declaration of a type that is a member of that namespace? If not, that's the issue. If so, what type(s) and what assembly? If you're not completely sure what assemblies and namespaces are and what it means to reference and import them, I suggest that you follow the Blog link in my signature below and check out my post on the subject.
 
The program will scan and exchange data with a bluetooth device. But right at the start, I get this "The type or namespace name 'Windows' could not be found" from the following two line in the code below.



C#:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.System;    //<--- offending line

using Windows.Devices.Bluetooth.Advertisement;    //<--- offending line

Did I miss a reference or something? I use VS 2019. How can I fix this?
As I was going rounds on Google, I came across this site about C# Bluetooth communication in Japanese. The site said that we need the Microsoft.Windows.SDK.Contracts nuget package. I installed it and the error was fixed ?
 
Solution
Back
Top Bottom