TFS dll and references issues

2019-01-13 19:39发布

问题:

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?

回答1:

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.

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

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.