16

We use Team Foundation Server for our main project. Every time we add a new employee either onsite or offsite we always have to set up the references manually.

Is it possible for TFS to copy/save/pass the dll's to the new user without having to install them every time?

For example I add new functionality and install DocumentFormat.OpenXml to my project. Set up the code it runs and works fine on my machine, I publish it works just fine live. I check in everything into TFS.

My co worker downloads the project attempts to build it and it errors out saying it doesn't know what to do with DocumentFormat.OpenXml because no reference exist.

So they they must download DocumentFormat.OpenXml and then they can build and run the project.

Is there a way for TFS to save us this step?

John Saunders
  • 160,644
  • 26
  • 247
  • 397
James Wilson
  • 5,074
  • 16
  • 63
  • 122
  • 3
    Add external dependencies to the project directory in TFS. Reference them via relative paths. –  Aug 14 '13 at 17:56
  • 1
    @Will is there a document out there that can walk me through this? I've never uses TFS before this project so I'm stumbling around in the dark with most of it. – James Wilson Aug 14 '13 at 17:58
  • 2
    Nothing to do with TFS, really. In your solution, add a folder called "Dependencies". Add a matching folder on disk in the same location in your solution hierarchy (annoying, I know). Add your dependent external DLLs to that directory. Reference these in your projects via relative paths (e.g., "..\..\dependencies\derp.dll"). Then check in your solution. The dlls will travel with the solution, and anybody getting latest gets these dlls. Its like any other file. Check them in. You need to version your dependencies as you do your code, anyhow. –  Aug 14 '13 at 18:16
  • 1
    @Will Ahh that makes sense, thank you. I also noticed I could 'check in' the 'bin' folder which contained the same dll's is that a good/ok or terrible idea to do? – James Wilson Aug 14 '13 at 18:26
  • You should never check in any /bin or /obj folders as they are populated at compile time. If DLLs are checked in when you try to build it will probably fail (read only). –  Aug 14 '13 at 18:49
  • You need to give an example of what you're doing. There is no general problem with TFS and references. This specific problem must have to do with what you're specifically doing. – John Saunders Aug 14 '13 at 19:05
  • @JohnSaunders I'm not sure how else to describe the problem for you other than how I have in the original post. Each new user who downloads the project from TFS does not have access to any third party tools added (example DocumentFormat.OpenXML) each new user has to download that for them to be able to build and run the application. – James Wilson Aug 14 '13 at 20:15
  • @Will Thanks I will not add those files in /bin then. – James Wilson Aug 14 '13 at 20:19
  • You didn't say where the third party tools are located in your environment, or whether they are checked into TFS. – John Saunders Aug 14 '13 at 20:30
  • @JohnSaunders as far as I'm aware I know of no way to check them into TFS outside of what Will suggested. I can't add the /bin folder or the /References folder which is the only two locations I can find the needed .dlls – James Wilson Aug 14 '13 at 21:08
  • 2
    I'll compile my comments into an answer, if that solves your problem. –  Aug 14 '13 at 21:15
  • Look at "[Visual Studio Team Foundation Server Branching and Merging Guide](http://vsarbranchingguide.codeplex.com/)", download the .zip and find the "Advanced Version Control Guide". Read "Managing Shared Resources". – John Saunders Aug 14 '13 at 22:37

1 Answers1

44

Nothing to do with TFS, really. You just have to check in your dependencies to source control.

In your solution, add a folder called "Dependencies". Add a matching folder on disk in the same location in your solution hierarchy (annoying, I know). Add your dependent external DLLs to that directory.

enter image description here

As these are now part of the solution, they will travel with the solution into source control.

Reference these in your projects. It will look like this

enter image description here

but it should be recorded in your solution file as a relative path.

<Reference Include="Example">
  <HintPath>..\..\..\Dependencies\Example.DLL</HintPath>
</Reference>

If you're having problems with this not being the case, you can simply edit your project file and change the hint path.

  • 5
    You don't have to add the folder twice, you can add it in the file explorer, then click Show All Files in Solution Explorer, then right click your dependencies folder and choose Include in Project. – majjam Jan 13 '16 at 15:19