Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Someone deployed a webpart to our site that left and that webpart changed the globalbreadcrumb banner of the sitecollection. The webpart is needed to be used, but I want to remove the code that is overriding the banner. I was trying to see how to do this without the actual solution that was created with visual studio. All I have is access to the deployed webpart file.

share|improve this question

2 Answers 2

It's easiest if the webpart was deployed with a solution package. In that case, the wsp file will have everything you need. If there was no solution package, it will be harder to do, but you can still get all of the necessary pieces from the web server.

Basically, you want to recreate in Visual Studio what the other developer had. You want to use the same solution and feature IDs, so that when you upgrade or redeploy, the existing site will begin using your modifications.

Recreating the xml and ascx files is not that difficult. The trick is the code. For that, use Reflector or dotPeek to decompile the DLL back into code. You can then copy the code from those utilities into class files into your Visual Studio project.

share|improve this answer
    
So from what you're saying if I changed webpart file to a .cat file and extract the contents and open the .dll, which would have all the webpart code and use that as a new solution file within visual studio and redeploy? –  Jake Sep 20 '11 at 14:11
    
The webpart file is just an xml file. But, yes, change the solution package extension from wsp to cab and then extract the contents. Included in the contents should be (among other things) a webpart file and a DLL. Open the DLL in Reflector or dotPeek and it will give you the source code. The combination of the decompiled source code along with the other xml files extracted from the solution package can be arranged within Visual Studio to create a new version of the solution package which can be redeployed to your server. –  Rich Bennema Sep 20 '11 at 16:02
    
thanks that was a lot of help –  Jake Sep 20 '11 at 16:20

If it is a custom webpart (probably it is, you mention Visual Studio) you are out of luck. It is a all-or-nothing deal. You cannot remove parts of a webpart, unless the developer who created it has added options for that (use the 'modify (shared) webpart' option in SharePoint to see the configuration options of the webpart).

The webpart is rendered by the code associated to the webpart (look in the webpart definition file to find out which dll). The code in this dll is responsible for all of the actions the webpart takes.

Your best option is to get the code, comment out the bits of code you don't need, compile and redeploy.

You may have a backdoor: if it is a 'visual webpart' you can edit the control it loads, although not recommended since the controls lives in the 14-hive on the server.

share|improve this answer
    
So from what you're saying if I changed file to a cat file and extract the contents and open the .dll, which would have all the webpart code and use that as a new solution file within visual studio and redeploy? –  Jake Sep 20 '11 at 14:10
    
The DLL will contain compiled code, that is not human readable (or editable). If you have good knowledge of the internal workings of webparts/solutions/etc you could pull it off, but it is tricky. It all depends on what the WebPart does and how it was designed. –  Dribbel Sep 20 '11 at 14:56

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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