7

I am trying to work with GeoCoordinate which is meant to be supported by .Net Framework 4.5. I am working on winodws 8 and I have .Net Framework 4.5, but I keep getting The type or namespace name 'Device' does not exist in the namespace 'System' error.

Any solution?

Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574
Mehraban
  • 3,164
  • 4
  • 37
  • 60
  • 5
    Do you have a assembly reference to `System.Device.dll` in place?" – Sriram Sakthivel Apr 22 '14 at 06:08
  • You're welcome. You can delete the question. – Sriram Sakthivel Apr 22 '14 at 06:12
  • I don't know if it is Ok or not. Is the question all that useless? – Mehraban Apr 22 '14 at 06:13
  • No, Don't take me wrong. Before getting any answers you got the answer through comments. So keeping the question open simply is not useful. At least it should have answer or better no question itself. – Sriram Sakthivel Apr 22 '14 at 06:15
  • Please do not add "[Resolved]" to titles of questions. (cc @Reza) – Cody Gray - on strike Apr 22 '14 at 06:37
  • @GrantWinney Added as the answer ;) – Sriram Sakthivel Apr 22 '14 at 06:50
  • 1
    @CodyGray Thanks for your comment, would you explain why adding [Resolved] to question title it bad? – Reza Apr 22 '14 at 07:59
  • 1
    @Reza It just adds unnecessary noise. A question is already marked as "resolved" by the green checkmark next to the accepted answer. And of course, by design, only the person who asked the question can select the answer that resolved their issue. There's been lots of discussion about this over on the Meta site, if you're interested. Check, for example, http://meta.stackexchange.com/questions/116101/is-it-ok-to-add-solved-to-the-title-of-a-question and the linked questions. – Cody Gray - on strike Apr 22 '14 at 18:56
  • how did you solve it? When I use a code in windows it works,and when i use the same code in mac,it fails – Jerin Cherian Jun 26 '20 at 12:37
  • @JerinCherian I can't remember all the details since 6 years has passed but according to my accepted answer and comments, seems that I just added according assembly reference. – Mehraban Jun 27 '20 at 05:49

4 Answers4

11

The type or namespace name 'XXX' could not be found...

Always bear in mind, if you get this error there are three possibilities.

  1. You missed the using directive.
  2. You missed the Assembly reference
  3. You have "using directive" as well as "Assembly reference" in place but the current project's target framework version is lower than the referenced assembly target framework version.

Almost all the cases above three steps should solve the problem.

Hope this helps.

Right leg
  • 16,080
  • 7
  • 48
  • 81
Sriram Sakthivel
  • 72,067
  • 7
  • 111
  • 189
4

Does not have added reference of System.Device dll in your project.

Steps to Add Reference.
1. Right click on the Reference folder on your project.
2. Select Add Reference.
3. Expand Assemblies option.
4. Search System.Device in the serach box at right corner side.
5. After searching, click on checkbox to select and click on ok.

Gobind Gupta
  • 203
  • 3
  • 13
3

If you are using VS.NET:

  1. Right click on the References folder on your project.
  2. Select Add Reference.
  3. Select the .NET tab (or select the Browse button if it is not a .NET Framework assembly).
  4. Double-click the assembly containing the namespace in the error message.
  5. Press the OK button.

If you are using the command line, use the /r: or /reference: option. For Example:

csc.exe /reference:System.Drawing.dll MyFontDisplayApp.cs

When you recompile, this error will no longer appear.

Ajit Kumar
  • 534
  • 3
  • 8
1

It is also possible that your project uses x64 libraries and your machine has limited x64 libraries. I think this happened in my case. Possible Solution: I copied library from x86 folder to bin folder of my project. Then added the new reference(discard the old reference to same library). AND IT WORKED. Note: Please correct me if I am wrong here.

Mehraban
  • 3,164
  • 4
  • 37
  • 60
bpatel20
  • 11
  • 1