0

I am totally confused on how WSP files need to be deployed and activated inside SharePoint 2013.now I have the following three scenarios where i dealt with WSP files inside my SharePoint 2013 :-

  1. I needed to create a new column type that allows having lookup columns with autocomplete capabilities. So I found this link

Where I added the feature by running the following:-

Adding Solution:

stsadm.exe -o addsolution -filename C:\NY.Autocomplete.LookupField.wsp

Deploy Solution:

stsadm.exe -o deploysolution -name NY.Autocomplete.LookupField.wsp -immediate -allowgacdeployment

  1. I also need to add a custom redirect to my SharePoint server 2013 ,, as mentioned in this link link .so I created a new visual studio project of type "Farm solution" ,and i added the following code :-

    protected override void OnInit(EventArgs e) { var request = HttpContext.Current.Request; var response = HttpContext.Current.Response;

            if (!String.IsNullOrEmpty(request.QueryString["TreeField"])
                && !String.IsNullOrEmpty(request.QueryString["TreeValue"]))
            {
                response.Redirect(String.Format("{0}?TreeField={1}&TreeValue={2}",
                    SPContext.Current.ListItem.ParentList.DefaultViewUrl,
                    request.QueryString["TreeField"],
                    request.QueryString["TreeValue"]));
            }
            else if (!String.IsNullOrEmpty(request.QueryString["TreeField"]))
            {
                response.Redirect(String.Format("{0}?TreeField={1}",
                    SPContext.Current.ListItem.ParentList.DefaultViewUrl,
                    request.QueryString["TreeField"]));
            }
            base.OnInit(e);
        }
    
        protected void Page_Load(object sender, EventArgs e)
        {
        }
    

and I deploy it in the same way as used in the first point.

  1. Now I want to add new custom site columns as mentioned on this link link. then I upload the wsp to my site collection using the solution gallery.

I have the following points:-

  • Now for the first point the new site column type was automatically added to all the site collections, without even activating any feature at the site collection level.

  • While for the second solution the new solution became available under “custom web parts” only after activating the related site collection feature

  • While for the third point when I upload the wsp to the site collection gallery a new “site feature” not site collection feature , became available and I activate this.

So my question is what determine which approach to follow & the associated Behavior?

I mean why in the first approach the new site column type will be available to all the site collections without the need to activate any site collection feature ?. While in the second approach , I need to activate a site collection feature to get the new web part available inside the “custom web part” tab.

While in the third approach used for adding new site columns, I can upload the solution to each site collection separately?

1 Answer 1

1

First of all WSP Solutions are of two types. Farm based and Sandboxed. Sanboxed solutions are more restrictive in nature. They can be deployed by site collection owner whereas user needs to have administrative privileges to run or deploy Farm based solutions. Sandboxed solutions are uploaded in solution gallery and can be deployed from there. Whereas Farm based solutions are usually deployed from PowerShell or Stsadm.exe.

It is the features in the solution which determine the scope. A Farm based solution can have features with Scope Farm, Web Application, Site, Web. There can also be cases where there is no feature at all. Just like the example 1 in your case. The solution is example 1 is a Farm based solution which creates a custom column. All the artifacts in the solution get deployed to physical hive except the dll which gets deployed to GAC. Hence it is available in all site collections.

The sandboxed solution is deployed in a site collection, hence it can have features with scope Site or Web only.

3
  • @Nadeen Yousuf ok thanks a lot for the reply, but now in my second case i have created a farm solution , and i add a visualwebpart to the farm solution, then i override the visual web part OnInit() method. but to get this new solution inside my site collections, i needed to activate a site collection feature first ,, as my solution will not appear in the custom web parts unless i activate the site collection feature first,, unlike the first approach ,, is this due to the farm solution scope ??
    – John John
    Commented Jul 17, 2015 at 17:31
  • also in my second approach could i have created a sandbox solution instead of a farm solution ? i mean is it supported to create a custom web part using sand-boxed solution,, or i need to use farm solution if i want to create new web part ?
    – John John
    Commented Jul 17, 2015 at 17:45
  • In second case you are developing a visual webpart. It puts the .ascx in physical path. Hence it needs to be a farm solution. Secondly, the webpart needs to be placed in web part gallery, hence it makes sense to have it as site scoped feature. Finally, a webpart can be created as a sandbox solution. But you can't create a visual webpart as sandbox, as it will have .ascx file which needs to be placed in physical hive which is not possible in sandbox solution. Commented Jul 18, 2015 at 3:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.