Tuesday, March 29, 2011

WSPBuilder: how to add the dll into GAC. DeploymentTarget

Everybody knows a wonderful and free tool -  WSPBuilder . I use it as an extension to Visual Studio:
 Recently I was wondering how to build a wsp with the strong signed dll to add it to the GAC.

There is a page crafted by the author of the tool which has a reference to bunch of post as a documentation "how-to" use the WSPBuilder
   Particularly for my task I was reading the post Change the WSPBuilder DeploymentTarget to WebApplication
I found useful to know that wsp has manifest file which describes what in the package and how sharepoint should handle it.

DeploymentTarget attribute defines where the dll should go
  The next question was how WSPBuilder decides what value to put into DeploymentTarget?
Possible values: GlobalAssemblyCache , WebApplication
  So, it turned out that WSPBuilder puts:
GlobalAssemblyCache  :
            - by default ;
            -if the name doesn't have a word "resources" (as I discovered);
            -the dll hasn't been put under folder 80\bin\
            - or "-DeploymentTarget" explicitly set to "GlobalAssemblyCache" in postbuild.scripts

The WSPBuilder has a config file where you can tune the params.

In my case my dll had a name "resources" and that was  the reason why WSPBuilder put it with DeploymentTarget=WebApplication. As soon as I renamed it, it wrote in the manifest file DeploymentTarget="GlobalAssemblyCache".

Happy WSPBuilding!