Freigeben über


Deploying solution having custom site definition specific to a web application and also to front end servers.

When we deploy the solution that contains custom site definition in central adminstration, it gets deployed globally. But what if we don't want that template to be shown in all web applications ? For this, we need to create a feature file with feature id in it and activate this feature only to the specific web application. The VisibilityFeatureDependency attribute will check if the feature is activated or not. Only if the feature is activated, the corresponding template will be shown to the sites.

 1.     Create a custom feature folder and in that folder have only feature.xml file with Feature id in it.(e.g 9BA2485F-EF4B-401f-9167-FA4FE177C6F6 ) 
 2.     In the batch file, add command to deploy and activate that feature in the specified URL ( web application ).
 3.     Go to custom webtemp.xml file, and in the configuration tag, add the VisibilityFeatureDependency attribute.
 4.     Set the value of VisibilityFeatureDependency to the Feature id of the feature that we created.
 <Template Name="CustomTemplate" ID="10500">

    <Configuration ID="0" Title="MYCOMPANY Collection Site" Hidden="FALSE"

    Description="This is a collection site for MyCompany"

    ProvisionAssembly="Microsoft.SharePoint.Publishing, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"

    ProvisionClass="Microsoft.SharePoint.Publishing.PortalProvisioningProvider"

    ProvisionData="xml\\MYCOMPANYCollectionWebManifest.xml"

    RootWebOnly="TRUE"

    DisplayCategory="MYCOMPANY"

    Type="0"

    VisibilityFeatureDependency="9BA2485F-EF4B-401f-9167-FA4FE177C6F6"> 

    </Configuration>

</Template>

 
 5.     Run the batch file.
 6.     So, this will check only if the feature 9BA2485F-EF4B-401f-9167-FA4FE177C6F6is activated in site collection, the template will be shown.

When we install the feature, the feature gets installed globally in the farm. As we don’t want to show this feature in all web application, we can set the Hidden property to True in the feature file and then activate by giving the specific web application URL.

To deploy the solution only to front end servers, there is option available in solution element. The DeploymentServerType property needs to be set as WebFrontEnd.

<Solution

  DeploymentServerType = "ApplicationServer" | "WebFrontEnd"

  ResetWebServer = "TRUE" | "FALSE"

  SolutionId = "Text">

</Solution>

Comments