Namespace Problem

  • Thread starter Thread starter CJ Silin
  • Start date Start date
C

CJ Silin

Hello, I have a solution which is comprised of 4 projects. One of the
project is "used" by the other 3. In each of those 3 project, I created
a reference to the project it was going to be using and I placed a
"using" statement for the namespace in each of the three projects. All
was fine with the world. I compiled and was able to use the solution
just fine.

Then I began to perform some maintenance on the project and now when I
go to compile, each of my "using" statements which references the
project being used by that class now highlights.

This has happened to me once before and I tried all kinds of things to
"fix" it and it finally started working again, but I was never quite
sure why. Now it has happened again and I would like to know how to
properly handle this problem again an understand what is causing it.

I suspect that when there is some sort of compile error in the project
which is being used, that perhaps this causes this problem. Even though
I have corrected the problem with class, It still does not clear up the
problem.

When I create a reference to a project....do I point it to the "dll" of
the class which I am referencing or should I be pointing to something
else? I am actually pointing to the "dll" in the bin/debug folder.

Any Ideas as to what is going wrong?
 
CJ Silin said:
When I create a reference to a project....do I point it to the "dll" of
the class which I am referencing or should I be pointing to something
else? I am actually pointing to the "dll" in the bin/debug folder.

Any Ideas as to what is going wrong?

Hi CJ,

You are using a file reference, which sounds like it is the root of your
problems. Instead, use a project reference by selecting Add Reference from
the project context menu, select the Projects tab of the Add Reference
dialog, select the library you want and click OK. This way, every time you
recompile the referencing project, it will ensure that the most recent
version of the library is available in its local directory.

I used to have all kinds of problems with this stuff until I read this:

Team Development with Visual Studio .NET and Visual SourceSafe
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnbda/html/tdlg_rm.asp

Joe
 
Hi,

Moreover, when you use file reference and point to a dll, when you compile
the Release version of the referncing project, you get the debug version of
the dll of the referenced project.

It means that if you point a dll reference you always get the same version
of the referenced dll for both Debug and Release and it does not get
automatically recompiled.

In this way, you:
- either are distributing and compiling with the debug version of the
referenced project (if you point to Debug dll)
- or are unable do debug the referenced project with the referencing project
(if you point to Release dll)

It's a good idea to reference to Release dlls if you have a closed, stable
project and have many projects in the solution and adding another one
becomes unhandy and makes the comile times longer.

Cezary Nolewajka
mailto:[email protected]
remove all "no-sp-am-eh"s to reply
 
Back
Top