When adding a reference to an assembly located within the solution directory, is there any way to add it relatively, so that when checked in and out of a repository it is referenced in projects correctly?
Yes, just create a directory in your solution like lib/, and then add your dll to that directory in the filesystem and add it in the project (Add->Existing Item->etc). Then add the reference based on your project.
I have done this several times under svn and under cvs.
When you go to your project, right click on References and click Add Reference, go to the Browse tab and you can add a dll from anywhere within your solution (i.e. in a Library folder in the root directory of your solution).
Probably, the easiest way to achieve this is to simply add the reference to the assembly and then (manually) patch the textual representation of the reference in the corresponding Visual Studio project file (extension .csproj) such that it becomes relative.
I've done this plenty of times in VS 2005 without any problems.
I agree with Pavel Minaev's original comment on jimioh's post above ( I cannot comment on it directly because I don't have enough points)
To expand on this - The GUI for visual studio supports relative references with the assumption that your .sln is the root of the relative reference. So if you have a solution C:/myProj/myProj.sln, any references you add in subfolders of C:/myProj/ are automatically added as relative references.
To add a relative reference in a separate directory, such as C:/myReferences/myDLL.dll, do the following::
- Add the reference in Visual Studio GUI by right-click add reference
- Find the *.csproj where this reference exist and open it in a text editor
Edit the < HintPath > to be equal to
< HintPath >....\myReferences\myDLL.dll< /HintPath >
This now references C:/myReferences/myDLL.dll. (Also remove the spaces between angle brackets and HintPath)
Hope this helps.