How do I get my build agent to build a solution wi

2019-08-30 11:35发布

Currently I am plagued with two TFS build issues:

Issue one: I have a solution with a project that now references the dll product of another project in another solution. The build agent does not seem to include these dlls and the build fails.

Issue two: I have a solution that references the a project in another solution. The build agent does not seem to include the externally referenced project and the build fails.

I have looked at the "copy directory" build activity but have no idea where to shim that in or what to put as source and output values.

标签: tfs msbuild
2条回答
再贱就再见
2楼-- · 2019-08-30 12:12

The best practice is to use project references for referencing other projects within the same solution. For references which are external to your solution you should use file references, and then check in the compiled DLL which is being referenced.

Solution1
  \Project1  --> Project1.dll
  \Project2  --> Project2.dll

Solution2
  \ProjectA (references Project1.dll)
  \ProjectB (references Project2.dll)
  \References
      \Project1.dll -- this DLL gets checked in here and ProjectA references from here
      \Project2.dll -- this DLL gets checked in here and ProjectB references from here

ProjectA.csproj

<Reference Include="Project1.dll, Version=blah blah blah">
   <HintPath>..\References\Project1.dll</HintPath>
</Reference>

ProjectB.csproj

<Reference Include="Project2.dll, Version=blah blah blah">
   <HintPath>..\References\Project2.dll</HintPath>
</Reference>

With this approach you have to build Solution1, get the DLLs which get dropped, and then check them into the References folder for Solution2. You can get real fancy and setup some logic in the build for Solution1 which automatically checks out the Solution2\References folder, replaces the Project1 and Project2 DLLs with the latest from the build, and then checks them in... and if you're using Continuous Integration this kicks off the build for Solution2.

查看更多
爷、活的狠高调
3楼-- · 2019-08-30 12:16

If you are using TFS 2012 / TFS2010 build templates, make sure that the property "Solution Specific Build Output" set to false. This will ensure that the build agent builds all assemblies in the same bin directory.

查看更多
登录 后发表回答