3

Occasionally on our deployments, we would get this error

Error occurred in deployment step 'Add Solution': A feature with ID {Guid} has already been installed in this farm. Use the force attribute to explicitly re-install the feature.

To fix this, we set the Always Force Install property of the feature in Visual Studio to True and this fixes it.

Are there any downsides to setting this property to True for all our features so we don't encounter this issue again? What would be the implication if going forward we just set this to True all the time?

2 Answers 2

2
+50

On http://msdn.microsoft.com/en-us/library/office/ms436075(v=office.15).aspx there's a remark about feature event handlers:

Optional Boolean. TRUE if the Feature is installed by force during installation even if the Feature is already installed. For example, if set to TRUE, Feature deployment event handlers will always fire anytime a user tries to install the Feature (even if it is already installed) by using either the scanforfeatures or installfeature command-line operation. This attribute equals FALSE by default. The AlwaysForceInstall attribute affects Features of all scopes.

Whether that is a problem or not depends pretty much on what you are doing with your event handlers.

2

This had happened to me a lot recently. Sometimes conflicts will occur if you rename or move the solution. There are risks in force installing solutions as it would be overwriting the existing wsp in the solution gallery. Which means, once installed, it will also overwrite the dll, usercontrols, script or any other assets included in your package.

A big consideration is if you have a feature receiver which overrides the FeatureInstalling / Activating method (If you have auto activation set), this could overwrite lists or fields depending on the logic you have in place. Personally, I turn this force Install on as well since I know exactly what my package includes. In a development environment this is not a risk for me as I am constantly deploying solutions.

I can potentially see a risk for you in that if you are unaware what changes have been made to any files, the most up to date ones could exist in your hive and not the solution. For example, if someone was to update a Script or CSS folder residing in /_layouts and you force install a solution, you will loose those changes.

To be safe, and without doing a complete analysis on all of your solutions, I suggest backing up all WSPs in the gallery so they can be easily rolled back if there are issues. I use the following script to transfer WSPs between environments without using Visual Studio or for backup purposes (written by Juan Carlos González) :

If ((Get-PSSnapIn -Name Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue) -eq $null )  
{ Add-PSSnapIn -Name Microsoft.SharePoint.PowerShell } 

$host.Runspace.ThreadOptions = "ReuseThread" 

#Function that gets all the WSPs (Farm Solutions) stored in the farm 
function GetAllWSPs 
{     
  write-host "Started the process of extraction solutions in the global solutions  catalog ...." -foregroundcolor yellow  
try 
{ 
    $spSolutions = Get-SPSolution         
    foreach($spSolution in $spSolutions)  
    {              
        Write-Host "Extrayendo la solución $spSolution" -ForegroundColor Yellow 
        $spSolutionFile=$spSolution.SolutionFile             
        $spSolutionFile.SaveAs($ScriptDir  + "\" + $spSolution.DisplayName) 
     }  
 } 
 catch [System.Exception] 
  { 
      write-host -f red $_.Exception.ToString() 
  } 
}  

Start-SPAssignment –Global 
$ScriptDir = Split-Path -parent $MyInvocation.MyCommand.Path 
GetAllWSPs 
Stop-SPAssignment –Global 
Remove-PsSnapin Microsoft.SharePoint.PowerShell
6
  • The question is about forcefully deploying features - not solutions. So it basically boils down to what you do in your event receivers.
    – lapsus
    May 7, 2014 at 11:52
  • The question may pertain to the feature, but "Force install" installs the solution and activates the feature and therefore all implications stated are valid and applicable May 13, 2014 at 22:20
  • the solution is being installed anyway - it doesn't matter if it already exists or not - there is not "force install solution" in VS. Solution artifacts will be replaced in this process - you are right about that.
    – lapsus
    May 14, 2014 at 6:33
  • That is inaccurate. I have been getting this error for the past few weeks on all of my solutions and they will not install until I set that attribute or force using Powershell. Otherwise, you get an 'Error' status in Central Admin May 14, 2014 at 18:31
  • 1
    get over yourself dude. Just trying to help the poster EOD is very arrogant May 14, 2014 at 20:14

Your Answer

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

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