3

I am working on deploying an event receiver inside my sharepoint 2013 sites using visual Studio. now i deploy the farm solution using visual studio successfully. Then i wanted to remove the farm solution completely. so i login to the sharepoint hosting server and i run the following command:

Remove-SPSolution -identity "cmorit_2.wsp"  -force

the command completed without any problem. and the solution disappear from "Central Administration >> System settings>> Manage Farm solutions". so i thought everything is fine.

but i am facing these 2 problems:-

  1. the feature name are still showing inside my site collections "manage site features" section, and i can active it , as shown below:-

enter image description here

  1. also i did some modifications to the event receiver inside Visual Studio and i deploy it again , but i got this error :-

Error 1 Error occurred in deployment step 'Add Solution': A feature with ID 15/ac3d38f9-49f6-4638-a65b-d15a8bbe40c2 has already been installed in this farm. Use the force attribute to explicitly re-install the feature. 0 0 CMorIT-2

so did the Remove-SPSolution actually remove the SPSolution!! as seems it is still their .

4

Completing removing a solution requires two steps:

  1. Retracting the solution (can be done from the the CA, or with Uninstall-SPSolution)
  2. Removing the solution (also, can be done from the CA, or with Remove-SPSolution

Using Remove-SPSolution -force as you did leaves your farm in a corrupted state where the solution is still activated (actually the correct term is "deployed" or "installed").

Also, even before removing a solution with the two steps above, you still need to disable (deactivate) all features on all sites it had been activated. Failing in doing so would also leave your farm in a "corrupted" state where some features are orphaned.

Visual Studio usually does all this for you (and this is a very bad thing, coz you don't know what it does exactly, and sometimes it also performs manual tasks in the hive, but that's another story).

In your current situation, I would try to add the solution back to SharePoint with a Add-SPSolution, then Install-SPSolution -force: that would overwrite features it's currently complaining about.

[EDIT]
Deactivating the feature everywhere it was activated is NOT done automatically by Uninstall-SPSolution: you have to do it "manually" everywhere the feature is activated (this can be done by a script as well).
However, if you only remove the solution to immediately add it back (instead of using Update-SPSolution), and the new version contains the same exact features, you don't really need to deactivate the features, as they won't be orphaned anymore when the solution is back online!

  • thanks for the info. now i tried executing "Add-SPSolution" & then "Install-SPSolution -force" again. but now the solution is showing inside the "Central administration>>Manage farm solutions" in the following status "Deploying(scheduled at..." so not sure what is going on. second point you mentioned that i need to deactivate the feature from all the sites, now in my case the feature is activated at around 10 subsites... so you mean i need to manually deactivate the feature from the 10 sub-sites before running the uninstall and remove commands ? – john Gu Oct 10 '16 at 22:19
  • i thought this will be done behind the scenes when i execute the uninstall-spsolution command !! can you adivce on this please? – john Gu Oct 10 '16 at 22:20
  • 1
    Deploying(scheduled at simply means deployent is not immediate but is done by a job that may takes a few minutes to run. Should be OK by now! I'll edit the answer for the other question you have. – Evariste Oct 11 '16 at 5:25
  • the problem is that seems the solution is stuck in "Deploying" status forever.. not sure what i can do with this? will accept the answer as you provided a great answer to my question,, and what i am facing now is something different – john Gu Oct 11 '16 at 12:26
  • 1
    Solutions stuck in Deploying may happen from time to time :(. One thing you can try: stop the SharePoint Administratin service (or use net stop SPAdminV4), run the PowerShell command Start-SPAdminJob and the restart the service (or net start SPAdminV4). – Evariste Oct 11 '16 at 13:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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