user410989
user410989

Reputation:

Change reference path from GAC to folder at compile time

I have a project that depends on some 3rd party libraries. These assemblies are registered int the GAC. Everythings works fine so far. But when building the project on the build server, the 3rd party assemblies are not in the GAC, but in an extra folder (called external) that is also in the SVN-repository the build server uses.

The build will fail due to the fact that MSBuild can't find these assemblies. Is there a way to tell MSBuild on the buildserver to use the assemblys from this folder instead of the GAC?

Upvotes: 3

Views: 616

Answers (2)

KMoraz
KMoraz

Reputation: 14164

The best practice is NOT to reference 3rd-party assemblies from the GAC on build time. Instead, have all 3rd-party assemblies referenced from a common source controlled folder.

If you open the projects with an editor, ideally you will have a HintPath for each 3rd-party reference. I.e:

<Reference Include="Microsoft.Practices.Unity">
  <HintPath>..\..\..\3rd Party\Prism4\Microsoft.Practices.Unity.dll</HintPath>
</Reference>

Upvotes: 2

Akuma
Akuma

Reputation: 571

This should work

MSBuild.exe "%BUILD_TARGET%" /t:rebuild /p:OutputPath="%OUTPUT_PATH%" /p:ReferencePath="%REF_PATH%"

The relevant bit would be the 'ReferencePath' parameter ofc :)

Upvotes: 0

Related Questions