Change the WSPBuilder DeploymentTarget to WebApplication

By default WSPBuilder builds solutions with the DeploymentTarget attribute set to GlobalAssemblyCache. All assemblies provisioned by the solution will be deployed to the Global Assembly Cache (GAC) of the target web server which might not always be desirable/doable. There are a couple of ways of how to change the DeploymentTarget to the bin directory of the target Web Application.

One way of changing the WSPBuilder’s default behavior is using the WSPBuilder.exe.config file. Changing the value of the DeploymentTarget settings would be applied globally instead on a per-project basis. Every WSP you build  on your development machine using WSPBuilder would be built with the DeploymentTarget set to WebApplication. While such approach would do the job, it would take away the flexibility that WSPBuilder is supposed to provide.

Building a WSP using WSPBuilder context menu in Visual Studio Another way of overriding the default setting is using the command line version from either MSBuild or post-build actions. Using the –DeploymentTarget switch you could set the DeploymentTarget to WebApplication. You are very likely to use this approach if you’re already using the command line tool to override other parameters. If the DeploymentTarget is the only thing you want to change there is a better way which also allows you to use the WSPBuilder context menu in Visual Studio.

What you need to do is to modify the Output Path of your project. Go to Project Properties > Build and change Output path to 80\bin\.

Changing the Output path of a project to 80\bin\

The idea behind this solution is that WSPBuilder automatically deploys all assemblies from the 80\bin\ directory to the bin directory of the target Web Application. Of course you could manually copy the assembly to 80\bin\ it’s way better to have it done automatically just to be sure that the WSP always contains the latest version.

From now on each time you build your project and let WSPBuilder build the assembly, it will be flagged inside the WSP as an assembly to be deployed in the bin directory of the target Web Application.

Technorati Tags: SharePoint, SharePoint 2007, WSS 3.0, MOSS 2007, WSPBuilder


comments powered by Disqus