This doesn't seem to make sense.
I'm trying to use the System.Device library in a project to take advantage of the geo location functionality. I'm adding code to a Razor page as I usually do.
I have a reference to the library and I've added the using to the top of the razor view:
@using System.Device;
Device has a red underline because it cannot be found. Typing System.D
does not yield Device
in intellisense. This doesn't seem to make sense as the library is definitely referenced.
The web.config is in Views has no mention of System.Device
. If I do a full search of the solution for 'device' there are no mentions of it anywhere I wouldn't expect.
I've open and closed files, removed the reference, restarted VS, restarted my computer. Everything. It still persists.
I feel like either there's something I don't know or I'm doing something stupid. Am I missing something here?
You need to add System.Device to your web.config. Depending on whether you're using Areas you may need to add it to the web.config for that area too. If it's not in web.config, razor doesn't know about it.
Further, try setting
Copy Local
to True for the Reference Properties of System.Device. It didn't work for me until I did both.