Not all features are available in farm after deploying solution with SPSolution.Deploy (DateTime, Boolean, Generic , Boolean) method. RRS feed

  • Question

  • Hi ,


    I am having issue while deploying wsp solution file using following method


    SPSolution.Deploy (DateTime, Boolean, Generic , Boolean)


    Even after solution is deployed to the farm (solution.Deployed is true)some of the features not available instantly in SPFarm.Local.FeatureDefinitions.


    If I put some delay after wsp deployment ,I use to get all the features in the farm.


    I have written following code sample to explain this issue .



                string _solutionName = "test";

                string solutionCabFilePath = "test.wsp";


                Console.WriteLine("Before deployment FeatureDefinitions Count= " + SPFarm.Local.FeatureDefinitions.Count);


                if (SPFarm.Local.Solutions[_solutionName] != null)


                    SPSolution solution = SPFarm.Local.Solutions[_solutionName];

                    solution.Deploy(DateTime.Now, true, webApplications, true);
                    while (!solution.Deployed){} /////Wait till the "solution deployed" flag is true.

                    if (solution.Deployed)


                        Console.WriteLine("Immediate after deployment FeatureDefinitions Count= " + SPFarm.Local.FeatureDefinitions.Count);


                        Console.WriteLine("8 sec delay and after that deployment FeatureDefinitions Count= " + SPFarm.Local.FeatureDefinitions.Count);





                Before deployment FeatureDefinitions Count =  268

                Immediate after deployment FeatureDefinitions Count= 276

                8 sec delay and after that deployment FeatureDefinitions Count = 278


    Here I am able to get all the features only after adding some delay in-between.

    And also this beavious is not consistent.Some time I get all the features instantly or some time after sleep.
    Is there any way I can check for ,if the solution is deployed completely?

    Thanks in advance.

    Friday, January 29, 2010 3:06 PM

All replies

  • Hi Alok - features are deployed across the farm by the asynchronous timer service, have a read of and note the stsdadm '-immediate' option...
    Monday, February 1, 2010 5:01 PM
  • Hi Patrick ,

    Thanks for your prompt reply.


    Some queries from your reply,


    1.       I am using SharePoint object model to deploy the solution. I am passing DateTime.Now while deploying the solution using SPSolution deploy method. I think that should start the deployment immediately. Is there anything wrong with my code sample?

    2.       I am not sure but I think when value for solution.Deployed is true ,All the features present in the solution should be deployed in farm. I have updated my code example to explain the same(Checking for the flag until its true and then check for the feature count).Do you mean even if solution.Deployed is true, some of the features present in the solution are not deployed across the farm? In that case is there any  other way I can check for the solution status is completed or not?

    Tuesday, February 2, 2010 9:26 AM
  • Solutions and their contents take time to deploy - even with the immediate flag - depending on the number of servers in the farm and the contents and size of the solutions.

    Running stsadm -o execadmsvcjobs will kick off any outstanding timer jobs but only on the server it run from. You may notice that when you create a new site - especially one that activates a large number of features - the creation process can take some time. Even after the "success" message you may notice that certain elements and subsites are still missing.

    Be patient. If your solution is adding a SafeControl to the web.config, as so many do, then trying to deploy too many at once can cause a conflict and lock-up the timer job. In this scenario restarting the timer service is often required.

    There is no hard and fast rule but 20 seconds usually seems to do. You can script this or do it via code. Your choice. As for testing to see if the solution has been deployed, this will only confirm that deployment was successful - not that all subsequent actions are completed.

    If at first you don't succeed, ask an MVP.
    • Edited by PANoone Wednesday, July 7, 2010 12:46 AM typo :)
    Wednesday, July 7, 2010 12:46 AM