Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have some logging and other common libraries that i want to use in my SharePoint solutions. These common dlls will be deployed to the GAC, i was thinking of creating a .wsp for them just on there own so that they are present and not linked to a specific piece of functionality.

In development in Visual Studio, how do i reference these shared dlls? If i reference them in my VS studio, will they deployed to the GAC along with the rest of my solution? That would mean that the same dlls are being deployed with every solution that i build that is using these common elements.

Or do i put them in the GAC on my dev box, reference them there and then when my solution is deployed it will know to look in the local GAC for the correct assemblies.

Thanks

share|improve this question

3 Answers 3

up vote 2 down vote accepted

Your approach is quite correct. Have a separate wsp and deploy the common dlls to GAC.
Now for your questions :

  1. For development of other solutions in Visual Studio which need to refer these dlls, Just add assembly references as you normally do, choose browse option and select the required dlls. I would recommend navigating to c:\windows\assembly\gac_msil\[your assembly name]\[version__public key token]\ and choosing your dll using the browse option, but any path will do.
  2. Just referencing some dll in a sharepoint solution does not deploy that dll during deployment of your solution. So you needn't worry.
  3. Whichever way you reference your dll in dev box, on the server the application is going to pick it up from GAC or the application's bin folder
share|improve this answer
    
Thanks for this guys @sebastien –  toby Mar 9 '12 at 14:35

You will have to deploy shared libraries to the gac if you are using Sharepoint objects... i had a simialar issue like this...

Issue Refrence

just have a look at my answer, it will explain why it must be installed in the gac. and how to add it to the Gac. their is also a seperate option. i have listed it their aswell

share|improve this answer

I've explained some possible approch in my anwser of the question Best practices for creating a shared code library for SharePoint projects.

Basically, what I'm suggesting is to build a wsp file with the required shared libraries. Then create a feature, just to say the libraries has been deployed.

In you project, you can simply reference your dll, set the copy local to false and build the wsp. As the dll will be in the gac on the target computer, it will be found.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.