2
votes

When I build a solution on my build server it generates a binaries folder and then later on copies these binaries to the final output folder. In my case some of the third party assemblies REFERENCES are correctly copied over while other 3rd part assemblies REFERENCES are not copied over. Take not that my solution projects do not directly reference the assemblies being copied over.

This means that everything build fine. But when I run my program it doesn't start since the assemblies it's referencing can't in turn load their references.

What process in the build determines what assemblies are copied over to the binaries folder? Is there any way to specify that it should copy all assemblies?

Edit : One possible solution is to just reference all required assemblies in one of the projects in the solution but this gets very messy.

3

3 Answers

5
votes

For ASP.NET projects there is a built in mechanism for this. Ensure required assemblies are in a folder under your project named _bin_deployableAssemblies and they will get automatically copied. To see how this customization is wired into the build of Web projects, find the file...

%PROGRAMFILES%\MSBuild\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets

And take a look at the _CopyBinDeployableAssemblies target. In that same file you can see it referenced like this...

<PropertyGroup>
  <PrepareForRunDependsOn>
    $(PrepareForRunDependsOn);
    CopySilverlightApplications;
    _CopyBinDeployableAssemblies;
  </PrepareForRunDependsOn>
  ...

You can do a similar customization on any project, since the target PrepareForRun is part of the common MSBuild targets in Visual Studio.

2
votes

Please do one thing, add the third party dlls to your bin folder and give reference to that dll in the bin folder.

Then build the solution and commit the results. This will copy the third party dlls in the bin folder.

0
votes

In some cases you need assemblies that you don't have as references to be copied, if that's the case see: Visual Studio Package build and DLLs in private bin path

If the above is not the case, check that all references you want copied have the property Copy Local: True.