1

i have a debug and a release version of an assembly dll.

They are sitting is directories on my computer. For other developers they are sitting in directories on their computer.

For the debug version of the application i want to use the debug assembly. For the release version of the application i want to use the release assembly.

That's the question.


For those not paying attention, there are quite a few issues here. How to reference an assembly on my computer, which after the project is checked into source control becomes a valid path on someone elses computer.

How to have the "References" node be per solution type (Debug, Release).

i tried copying the debug assembly to

\bin\Debug

and the release assembly to

\bin\Release

and added the assembly dll's to source control in the

\bin\Debug \bin\Release

folders. Then i hope that the assembly would be found in the executable's folder.

Problem with that is that other developer's machines get an error that the assembly dlls could not be overwritten - when CopyLocal is false.

2
  • Why do you need debug and release assemblies since you're referencing them? Feb 3, 2009 at 15:07
  • Right now i'm not referencing them individually. Right now i'm referencing the debug version of the assembly dll whether my project is in Debug or Release modes.
    – Ian Boyd
    Feb 3, 2009 at 18:57

3 Answers 3

8

Use a common structure for these DLLs (a common directory-name) and link to this relative.

Example from a .csproj-file:

<Reference Include="utils_xxx, Version=1.2.10.0, Culture=neutral, processorArchitecture=MSIL">
  <SpecificVersion>False</SpecificVersion>
  <HintPath>..\..\common_utils_dllproject_dir\utils\bin\$(Configuration)\utils_xxx.dll</HintPath>
</Reference>

You maybe have to enter this by hand, but once in the repo, it is the same for all. Now you just have to convince your developers to adjust to this directory-layout and -naming.

PS: If you overlooked it: $(Configuration) is the trick to use Release/Debug-DLLs.

3
  • i can't force a directory structure on every developer.
    – Ian Boyd
    Feb 3, 2009 at 18:55
  • Yes you can and yes you should. Otherwise you'll never be able to build anything with multiple developers in the mix.
    – Bigtoe
    Jul 23, 2012 at 11:08
  • I agree with @Bigtoe. One way to handle making sure the directory structure is the same for all developers is to put the "Common_utils" folder in the repository also.
    – Abraham
    Dec 18, 2014 at 17:33
1
  • Developers must have a folder somewhere on their machine structured like this...
[Parent Folder]
  Debug
    [Debug Assembly].dll
  Release
    [Release Assembly].dll
  • Open the project and add a reference to the Debug assembly from the first step. Check it in.
  • Have every developer open the project and add a reference path in the project properties. The path should be an absolute path to the Debug folder from the first step.
  • Have every developer close Visual Studio and edit the [project].user file that is now in the same folder as the project file. Change "Debug" to "$(Configuration)". Save and close.
  • This should now work. If you select the reference in the Solution Explorer and look at the Path property in the Property Grid, it may not be correct. It's just a VS issue. If you test building in Release and Debug, it should work.

This works because the reference paths that developers set are stored in a user file that never gets checked into source control. Therefore, the paths can be different for every dev. This solution is basically stolen from Leonidas' answer but uses reference paths.

Disclaimer
I don't know all the details of your situation, but I personally wouldn't do this. I would probably GAC the release version of the assembly on the developers' machines. Then I would have a build script that ran on a server that would take care of your complicated scenarios.

0

Include the project and link to the project? dont know if that does work in your situration...

1
  • It's not a project, it's an assembly.
    – Ian Boyd
    Feb 3, 2009 at 18:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.