Search code examples
.netvisual-studio-2010deploymentassembliesgac

How can I enforce VS to include the assemblies used in GAC to be copied to the output folder?


I have installed OpenXML SDK to my development machine and it registered the relevant assemlies to GAC as far as I can see. (For example: DocumentFormat.OpenXml)

I developed a console app.

But the thing is I want to deploy this app on a server where there is no OpenXML SDK installed.

QUESTION: How can I enforce Visual Studio to include the assemblies used in GAC to be copied to the output folder? (or should I find those assemblies and take a copy of them side by side with the console app's output folder instead?)


Solution

  • Yes, I do this:

    1. Mark those references as Copy Local = true. This puts the dlls in the bin folder after a build.

    That might be enough for you, but I do these following steps if I want to add those to source control so that other devs/build servers can find the assemblies:

    1. Then move them from the bin to some other folder in your solution.
    2. Remove the original reference.
    3. Add a new reference to the new location you have copied to.

    It's pretty much the same as the solution you were going to do, but the Copy Local step helps you find the exact dll that is being used rather than hunt around the GAC.