# How do I deploy the new version of a webpart?

As stated here (and as i checked), to upload a new version of an installed webpart, uninstalling the assembly from the GAC and installing the new version would suffice. I've tried it and it worked.

Now, in my development environment I have have a new version of my webpart. In production, I uninstall the .dll from the GAC, recycle the application pool and if I reload the page, the webparts are not shown. This is expected.

I then install the new version (directly taken from development environment's GAC), recycle again the pool, and the webparts are back on SP pages but those are the old versions! I've checked the browser cache and I've also performed an iisreset on the server, but nothing seems to work.

Where is SP taking the older version?

• What aspect of the web part is old? Its name in the web part gallery? In what way did your webpart change? – Steve P Jun 3 '11 at 10:51
• Same here, and I deployed the webpart in a solution (wsp)using powershell.. I did everyting, from resetting iis to physically rebooting the servere. The DLLs are correct, the other files (resources, aspx, js) are the old ones.. Where the heck is IIS taking them from? – Lorenzo Dematté Jan 12 '13 at 16:56

Also check that you dont have a version of the assembly in the BIN folder of your IIS website.

Note that it is considered a best practice to package your web part in a solution (WSP) and deploy it this way. Also as noted in SO answer, make sure that you are hitting the right WFE. If you have several web frontend servers, you must manually update all GAC's (this is handled automatically when using solutions and features).

You could debug the issue with Fuslogvw.exe or Process Explorer to find out exactly what assembly is loaded.

• hi, thanks for pointing me to Process Explorer. it while it shows that the dll is the right one, nonetheless the html generated by the webpart is different in the environments! – pistacchio Jun 6 '11 at 7:51
• does your web part contain user controls (.ascx files) that need to be updated too? – Anders Rask Jun 6 '11 at 10:05
• My dlls are right as well, is the html which is "old". Well, not event the "html", but the support files. They are NOT what is found under "Web Server Extensions\14\..." Does IIS copy them somewhere? – Lorenzo Dematté Jan 12 '13 at 16:58

Run with Powershell:

Update-SPSolution –Identity MyAwesomeWebPartsSolution.wsp –LiteralPath .\MyAwesomeWebPartsSolution.wsp –GACDeployment


This operation will recycle the application pool for you.

You say you recycle the app pool. Have you tried doing a complete iisreset?

I have seen the GAC get in a mess after multiple copies directly into the GAC. I have even had the entire contents of the GAC disappear from the explorer view! In all these cases a machine reboot seemed to solve the problem. No doubt there is a less drastic way of fixing this, but you generally don't have time to get to the bottom of it - you just need to get things working again and move on.

Or better still, don't deploy this way, as Anders says.

• hi, thanks for you answer. a complete serve reset didn't help the problem – pistacchio Jun 6 '11 at 7:51

I more this u have to do in web.config file of your web application

go to

C:\Inetpub\wwwroot\wss\VirtualDirectories\and find ur web application

open it with VStudio

Copy this code n paste it above

tag

and right click on that dll in gac and copy paste that value .....save then exit

restart IIS

stsadm.exe -o deletesolution -name *wspfile file name* -override

stsadm -o retractsolution -name *wspfile file name* -url site url -immediate


also need to remove the Web part from the site collection Web part gallery.

My fix involved a corrupted solution in VS2012.

The Custom Tool property for the webpart's .ascx file was blank. When I entered SharePointWebPartCodeGenerator I received a lot of compile errors. That's when I realized I had two ...ascx.g.cs files.

I deleted the file that did not appear under the web part file and got the solution to build. From there, it all worked fine.

I copied the files from a large solution into a smaller solution, and some namespaces were wrong. This caused other headaches in deployment. But the fix above finally made my changes to the .ascx appear when the webpart was deployed.