6

Possible Duplicate:
Update-SPSolution does not Deploy Solution

I have a wsp that is already deployed on the farm. I made some code changes. I cannot use the Add-SPSolution command because I receive an "wsp already exists" error.

All I sm trying to accomplish is update the wsp that exists in the solution store. Then afterhours via Central Admin I'd like to deploy this updated wsp.

There's an Update-SPSolution command. Can I use this command? What does the -GACDeployment option do? Will this actually deploy the wsp? Will this cause an IIS reset?

Thanks, Ninel

1

4 Answers 4

8

2007 version

stsadm -o upgradesolution -filename "drag drop the file here" -name "copy the name here including the wsp" -immediate -allowgacdeployment

just replace the writing in quotes with what is says! plus put them in quotes. DONT copy past the code above as it will execute and only throw an error, just write it out!

that should do the trick ;)

hope it helps :)

EDIT

PowerShell version

sorry here is the correct version :)

Update-SPSolution –Identity YourSolutionName.wsp –LiteralPath “C:\YourSolutionName.wsp” –GacDeployment

the first part you change YourSolutionName.wsp to the name of the solution, the second part C:\YourSolutionName.wsp is the folder path :)

http://technet.microsoft.com/en-us/library/ff607724.aspx

2
  • This is the SP2007 way Sep 14, 2012 at 15:33
  • sorry made the corrections :)
    – Ali Jafer
    Sep 14, 2012 at 15:46
5

This is how it really works:

If you have updated just your logic (code) and only need to update your DLL then you can do as @thantos suggests and use

Update-SPSolution

This command also works for updating your files (_layouts), as long as they are not stored in the database (unghosted).

If you have made any changes to any of these: Features, Package, Modules (Elements.xml) you can not use this command, and instead you could do as @almostSharepointMaster suggests.
Or you could tell SharePoint to upgrade your solution, this you can do with the two following actions:

  • Bump the version on your Features (open each Feature, set version).
  • Change the name of your Package (open the Package, change the name slightly).

By doing this the Update-SPSoltuion cmdlet should work as well.
If you happen to have your files in database, and you want this command to work you could add a FeatureActivated Event Receiver to your Features and delete the files.

5
  • Thanks everyone. I used the Update-SPSolution. It did work. I will be deploying after hours.
    – ninel
    Sep 14, 2012 at 17:45
  • what about a 3rd bullet: 'up' the AssemblyVersion property of the DLL that is going to be housed within your wsp package? Or, is that not true?
    – bkwdesign
    Jan 18, 2013 at 18:17
  • It might be true for all I know, and it probably should, but I have honestly never had any issues running Ùpdate-SPSolution -GACDeployment` on WSP files with newer DLL files. Do you have a link stating otherwise, @bkwdesign?
    – eirikb
    Jan 21, 2013 at 6:24
  • does this work with globally deployed workflows?
    – Mike
    Mar 21, 2013 at 21:31
  • Not sure @Mike, I hardly use workflows myself. But at least if you update only the DLL you should be safe
    – eirikb
    Mar 25, 2013 at 9:04
2
update-spsolution

is correct, -gacdeploy will make the solution full trust and is required for some solutions All this does is replace the current code, will not change the enables status of features or restart IIS

5
  • Update-SPSolution relies on version information in the solution. If this was not coded in the current wsp it will not make the changes.
    – ironman
    Sep 14, 2012 at 15:45
  • 2
    That is wrong, update-spsolution will copy over the files regardless of the version, it simple replaces the files here Sep 14, 2012 at 15:49
  • question was previously discussed here: sharepoint.stackexchange.com/questions/36770/…
    – ironman
    Sep 14, 2012 at 15:56
  • Per TechNet : "The Update-SPSolution cmdlet upgrades a deployed SharePoint solution in the farm. Use this cmdlet only if a new solution contains the same set of files and features as the deployed solution. If files and features are different, the solution must be retracted and redeployed by using the Uninstall-SPSolution and Install-SPSolution cmdlets, respectively." There are more details on MSDN as well
    – ironman
    Sep 14, 2012 at 15:58
  • Okay, both of us are right in a way, the features are NOT upgraded as in the structure of the feature, however, the physical files are updated as @erikb talks about, unless you use versions, but the question asked how to update a wsp, not the features themselves Sep 14, 2012 at 16:03
2

Deactivate the existing Solution in Central admin. System Settings -> Manage Farm Solutions -> select the .wsp to deactivate. Click "Retract Solution". After the Solution has been retracted you can click it again to "remove solution".

Now deploy your updated .wsp

http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2009/12/02/adding-and-deploying-solutions-with-powershell-in-sharepoint-2010.aspx

If the .wsp was coded to take updates then you can run an update, but if not the easiest way is to deactivate and retract the existing solution, then install the new .wsp solution.

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