Domanda

I have an Empty SharePoint 2013 project with a single feature (also empty, I am testing) scoped at WEB. When I deploy the solution it is deployed to all Web Applications and visible in every existing subsite.

GOAL: I want to see the feature only in Site Features of the specified WebApplication (WebApp5). I do not want to see it (Activated or not) in sites under any other WebApp (WebApp1, WebApp2, etc.)

What I tried so far:

  • deploy via VS (Build>>Deploy Solution)
  • publish and deploy via Powershell:
 Add-SPSolution -LiteralPath C:\published\crap1\1.2\testDeployment2.wsp
     Install-SPSolution -Identity testDeployment2.wsp -WebApplication http://win-0pjj59787on:28840/
  • publish and deploy via Powershell:
Add-SPSolution -LiteralPath C:\published\crap1\1.2\testDeployment2.wsp
    Install-SPSolution -Identity testDeployment2.wsp -WebApplication http://win-0pjj59787on:28840/ -GacDeployment
  • add safe control like this and like this

The solution shows as deployed to the one WebApplication, but the feature is still available and can be activated from any other WebApplication:

enter image description here enter image description here



Please tell me there is something better than hiding the feature.

È stato utile?

Soluzione

This is happening because the feature files get deployed into the File System and it gets picked up by all web applications.

There is no straight forward solution to this problem. The one workaround you can use is by creating a dependency with a web application feature

  1. Create an empty feature an scope it to web application
  2. Now open the web scoped feature and add a dependency to the above feature

Now if anyone tries to activate it in another site collection it will not get activated unless you activate the web application feature.

http://nikcharlebois.com/scoping-a-sharepoint-feature-for-a-specific-web-application/

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a sharepoint.stackexchange
scroll top