Question

I developed a SharePoint 2010 WSP that contains a custom HTTP Module for performing short-url redirects. The WSP also contains a WebApplication scoped feature that consists of a feature receiver that updates the web.config with a reference to the HTTP Module.

My problem is that when I install the WSP using powershell, it automatically enables the feature for all of the web applications on the server, with the exception of the Central Administration web application. I would like to be able to specify which web applications the feature is enabled for in my powershell deployment scripts.

Here is my script:

add-spsolution -LiteralPath "C:\temp\MyRedirectModule.wsp"
install-spsolution -Identity "MyRedirectModule.wsp" -GACDeployment

I have tried doing this:

install-spsolution -Identity "MyRedirectModule.wsp" -WebApplication http://mysite -GACDeployment

but this results in the following error message: This solution contains no resources scoped for a Web application and cannot be deployed to a particular Web application.

Thanks for your help!

Was it helpful?

Solution

Verify that Scope="WebApplication" on your feature definition. I'm also not sure it's looking for a URL after the -WebApplication switch...try the name or the GUID.

Alternatively, you could set ActivateOnDefault to FALSE in the feature definition and use Enable-SPFeature on the specific web application after the add-spsolution and install-spsolution commands.

OTHER TIPS

Any WSP deploying assemblies to GAC must be a farm solution and would be deployed on all Web Applications. Turning the ActivateOnDefault switch off only disables it in the features list of web application. If you need complete isolation of deployment and activation for a single web application, go with the BIN deployment.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top