File/Project References within Solutions

J

Jerad Rose

This is regarding Visual Studio 2003 (framework 1.1). We have several
projects/libraries. Of course, many of these reference each other. If we
only had one solution, we would simply add all of the libraries that we wish
to debug to the solution, and make project references to the other projects
within the solution. All other library references would be file references,
since they were not included in the solution.

However, the problem comes in when you have more than one solution sharing
different libraries. For example, take the following simplified setup:

Solution1
- Project1
- Project2
Project1 (project reference)
- Solution1TestClient

Solution2
- Project2
Project1 (file reference) - Project3
Project2 (project reference)
- Solution2TestClient

If the code (and project information) is being shared, then we obviously
can't have different reference types for Project2. Therefore, we are left
with either a) removing Project1 from Solution1, and making the Project1
reference in Project2 a file reference, or b) adding Project1 to Solution2,
and making the Project1 reference in Project2 a project reference. Of
course, this is an over-simplified example, and our situation is much more
complicated and will only get worse. But if I could find a solution to this
simple example, we should be able to apply it to our more complicated setup.

Now, you may be asking why we would want two different developers working on
Project2 code, but the point of including a project in a solution is not
always to be able to make modifications to it, but to have quick access to
the code for viewing. Also, there are cases where developers may be
assigned to different classes (files) within a project, and work may be
shared within a project, but by developers that are working on two different
solutions.

Is there not a way to tell visual studio to reference a project, and if it
detected that the project is not loaded, simply "auto-switch" the reference
to the file (or vice-versa, it would reference the compiled file, and detect
when the project was loaded and switch to a project reference)? This seemed
to work in VB6, where if would detect when a project is loaded, and change
the reference to the loaded project instead of the compiled file.

If this is not possible, then what workarounds have you guys implemented to
resolve this issue?

Thanks in advance for your help.

Jerad
 
M

Marina Levit [MVP]

I don't really understand your issue. It's a long post, and I'm really
confused as to what you are trying to do.

I'm not sure how multiple people are conflicting with each other. Everyone
has their own copy of the code, the projects, the solutions - why is this a
problem?
 
J

Jerad Rose

Thanks for the follow-up, Marina. I'll try to explain the exact issue.

It basically boils down to having to keep changing the reference type on a
project between a file reference and a project reference, because Visual
Studio is not smart enough to be able to make a generic reference to a
project and its binaries. We have to explicitly set it as either file OR
project reference.

And here's the problem with that:

Using the example setup in my original post, if my solution contains
Project2 but not Project1, then Project2's reference to Project1 needs to
point to Project1's DLL (file reference). If my teammate's solution
contains both Project1 and Project2, he then has to check out and change
Project2 so that its reference to Project1 points to Project1's project
(project reference). Then, if I need to get his latest changes to Project2,
I then have to check it out again and change the reference to Project1
*back* to a file reference.

But our situation is much worse, because our solutions contain several
common projects, but my solution doesn't include many dependent projects
that his solution does include -- so I have to do the above for several
files.

For now, I have resorted to just including every project in my solution that
his solution includes, but this should not be necessary and is not
practical -- especially if we were to grow to where our enterprise has
several different solutions, with them each containing/not containing shared
projects.

Hope that explains it. If not, feel free to follow up with questions and I
will try and clarify.

Thanks again for your help.

Jerad
 
M

Marina Levit [MVP]

I don't see why he has to change the reference to a project reference? Why
can't it always be a file reference?

All my solutions and projects are always 1 to 1, so I never have these
issues...

If there is no way to make it work, then the easiest way to solve this is
ask people to have one solution per project. It's really not that big a
deal - are they really making changes to 5 different projects at once? And
if you need more then one open, you can use multiple IDE windows.

But again, I'm not sure why you can't just stick to file references.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top