6

I was wondering, if I deploy a WSP using the stsadm command:

 stsadm -o addsolution –filename myWSP.wsp

Will this also install the required DLL's (already included in the WSP) into the GAC?

Or is this another manual process?

JL.
  • 78,954
  • 126
  • 311
  • 459

3 Answers3

10

This is determined by the DeploymentTarget attribute in the solution's manifest.xml. If you are maintaining this file yourself, using the following syntax will deploy the code to the GAC:

<Assemblies>
   <Assembly DeploymentTarget="GlobalAssemblyCache" 
             Location="MyGAC.dll" />
</Assemblies>

If you are using a tool to create the solution, it depends on the tool. WSPBuilder defaults to deploying to the GAC however it can be configured otherwise. See the "Scoping the assembly for BIN instead of GAC (including Code Access Security generation)" section of this article by Tobias Zimmergren for steps on how to deploy to bin.

Dan Abramov
  • 264,556
  • 84
  • 409
  • 511
Alex Angas
  • 59,219
  • 41
  • 137
  • 210
4

If you're building the packages via VS, open the Package and click the Advanced tab on the bottom. You'll be able to add additional assemblies and specify the Deployment Target from here. I'd strongly recommend doing this rather than updating the XML directly...but that's just me.

  • I can confirm this works for me in Visual Studio 2010. I think this is the most complete answer for a maintainable, out of the box solution. – Tom Resing Dec 21 '12 at 18:17
2

As the command says addsolution it is just going to add the solution to the Solution store. You need to call the command deploysolution to get the stuffs to place. Here is the command that you need to call

stsadmin -o deploysolution -name [solutionname] -allowgacdeployment

Note that allowgacdeployment is mandatory to place the files to gac. you can more help on this command with this

STSADM.EXE -help deploysolution

There is an alternate option to get this done,through UI. Go to Central Admin -> Operations ->Solution management select the solution and say deploy. this will be easier way to get it done quick.

Kusek
  • 5,384
  • 2
  • 25
  • 49
  • 1
    I think it is also important to say that the manifest file of the solution must define that the assembly should be deployed to the GAC and not to the web application's bin folder. This can be defined by the DeploymentTarget-attribute of the node. – Flo Aug 27 '09 at 08:22
  • 2
    Yes I agree. If you want to make it really simple you can use http://www.codeplex.com/wspbuilder where you need to drop the assemblies to the folder named GAC so that the attribute is taken care by the tool – Kusek Aug 27 '09 at 09:02