0

This is probably a very basic error on my part. Here's what I did:

  1. Created a new C# Smart Device Project in Visual Studio 2008.
  2. Added a C# project (Bouncy Castle) to this solution.
  3. Created a dependency: my Smart Device Project depends on crypto, the Bouncy Castle project.
  4. Added some using statements to my project:
    using Org.BouncyCastle.Crypto;
    using Org.BouncyCastle.Crypto.Parameters;
    using Org.BouncyCastle.Security;
    using Org.BouncyCastle.Utilities.Encoders;

Compiling the project gives me four CS0246 errors:

The type or namespace name 'Org' could not be found (are you missing
 a using directive or an assembly reference?)

I pulled the C# code into the project directly, so I don't know what I'm missing.

Thanks!

Lennart Regebro
  • 167,292
  • 41
  • 224
  • 251
John
  • 15,990
  • 10
  • 70
  • 110

1 Answers1

1

Created a dependency

Nobody ever says that. Which I'd have to guess is the source of the problem, you "add a reference". Project + Add Reference.

Hans Passant
  • 922,412
  • 146
  • 1,693
  • 2,536
  • @Hans: I went to Project -> Project Dependencies and said that my smartphone project depends on "crypto." However, I did manage to find crypto.dll and add that as a reference, and it got rid of the build errors. But if I have the source code, do I need to link to a DLL? I thought that referring to a DLL was only necessary if I didn't have the source code. – John Jan 13 '11 at 19:50
  • You don't need the source code if you've already got a compiled assembly. You don't 'link' it, you reference it. Linking is a C/C++ term. – Hans Passant Jan 13 '11 at 19:54
  • I've run across cases for which library writers offer DLLs but they don't contain all of the functionality that's present in the source code. I don't think it matters in my case, but I sense there's a way to reference the code from one project in another project without a compiled assembly? Or are compiled assemblies the way that it's done? – John Jan 13 '11 at 20:01
  • Compiled assemblies is the way it is done. The compiler reads the metadata in the assembly to know what types it contains. – Hans Passant Jan 13 '11 at 20:04
  • Just an addendum: I ended up getting things working simply by adding the appropriate .cs files to the solution. Dealing with a third-party library AND not having admin rights on my machine was getting too tedious. An additional benefit is that the included code is a lot less. – John Jan 27 '11 at 20:29