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.

Possibly related posts

8 Responses to “Change the WSPBuilder DeploymentTarget to WebApplication”

  1. liquidpooled Says:

    Modifying the WSPBuilder.exe.config file does not have to be a global change. Individual copies of the config file can be maintained for an individual project. By placing a WSPBuilder.exe.config in the root of your Visual Studio project, it will override the global configuration file. I would think this would be preferable, as you can maintain the config file in your SCM, and also maintain all of the options that WSPBuilder affords on a project by project basis.

  2. Waldek Mastykarz Says:

    @liquidpooled: Doesn't the .exe.config have to be in the same directory as the exe? If that would work it would be cool indeed! Thanks for the tip :)

  3. liquidpooled Says:

    @Waldek – Just place a local copy of the config file (modified however you would like) in the root of your Visual Studio project. This is as of the latest release (http://www.codeplex.com/wspbuilder/Release/ProjectReleases.aspx?ReleaseId=16820) (Search for "local config").

  4. Waldek Mastykarz Says:

    @liquidpooled: Sweet! Must've missed this one. Thanks :)

  5. Pramesh Says:

    Thanks for the post. Very useful.

  6. Raghavendra Says:

    Thank you very much. That helped me!

  7. venki Says:

    Thanks you very much. I had a small issue when I deployed my solution. I have deployed my solution to one webapplication.

    But other applications also showing this feature when I check in the site collection features page. When I activate the feature ..I could see that respective master page in the master page dropdown..and when select it and go to home page ..saying unexpected error. It shouldn\'t show to all applications since I deployed to particular application. Did I do any mistake in my class or?? Thanks in advance.

  8. Waldek Mastykarz Says:

    @venki: Unfortunately for you, that's the way SharePoint works. After deploying the Solution, the Feature is being copied to the 12 SharePoint directory. From there it is visible to every Web Application/Site Collection/Site in the whole Farm and there is nothing you can do about it.

Leave a Reply

Security Code:

WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS
Copyright © 2007 - 2010 Waldek Mastykarz

Creative Commons License