Editing contents of a WSP (SharePoint)

Source: Internet
Author: User

Editing contents of a WSP (SharePoint)

July 7, 2010

When deploying a new SharePoint feature for a trial upgrade 2010 environment, I was striking a problem with the contents of the WSP.

Inconsequential to this story, there was a system. Web. dll file within the WSP-And SharePoint 2010 wocould not allow it to be deployed (which is a good thing !)

 

My thinking was to just 'delete' the offending DLL from the WSP, and re-deploy.

WSP-> cab file

In case you were unaware, you can see the contents of the WSP by changing the file extension to cab.

You can then open the file like a zip file within Windows Explorer, or via WinRAR (my choice of zipper ).

Can't update Contents

But-and this is the annoying bit-you cannot change the contents of the cab file, and thus the contents of the WSP. for a file type that is vital to the operation of SharePoint 2010, there is no waySimplyModify the innards of a WSP file.

The preferred approach (?) Is to open the WSP within Visual Studio 2010-and/or visual Studio 2008 along with wspbuilder. but-that's not really a workable solution, when needing to do a 'quick' Update-or modify the contents within a server environment.

No, I'm not going to install Visual Studio on the server !!

The Problem

So-how do you do it ?? How do you delete a file from a WSP-and/or update the manifest. xml file?

From some fiddling, testing and trials-theseDon'tWork:

  • Creating a new archive file within Windows Explorer-and changing to cab or WSP Extension
  • Trying to delete or drag into an archive shown in Windows Explorer
  • Creating a new archive with WinRAR-and/or dragging into a cab file using WinRAR
  • Using makecab. EXE to create an archive via command line
      • It's just too fiddly & difficult
      • Need a DDF definition file to define the constructs-if needing to do more than one file (!)
      • And, the help files from Microsoft (for makecab + cab SDK) have been dropped/yanked
      • All other technical documentation in this area relates to MS-BUILD instead.
  • Try a different zipping tool (7-zip), based on a recommendation from a work friend to create or edit cab
  • Try yet another zipping tool (izarc)-after another work friend said that he 'd used it with success (?)

But-none of the above worked for me!

Aaarrrrgggghhhh !!

About the only way that I coshould think of-and supported by suggestions from other work colleagues-was to use wspbuilder and/or Visual Studio.

I'm staggered-and a little bit annoyed-that there is no decent tools for managing the contents WSP's-especially given the importance (Vitality !) For SharePoint 2010.

If anyone knows of any such tools-then let me know-please!

The solution:

I'm happy to report that there is one such zipper product (Tool) that allows you to create a CAB archive-and then rename TO BE A WSP-and problem solved!

It turns out I was sooo close to getting it sorted out-using izarc-there's a minor quirk which I'll explain in a moment-but it definitely works! Yay!

The steps involved to update the WSP are as follows:

  1. Rename the WSP to cab
  2. Extract all contents to a folder-using Windows Explorer, or WinZip, WinRAR, or whatever
  3. Change the items you want, ie. manifest. xml and remove a DLL (in my case)
  4. Create a new cab file with the updated contents, using izarc
  5. Rename the newly created cab to WSP
  6. Install to SharePoint

-------

NB. I'm using a WSP FOR THE SharePoint Reporting Services webparts-just as an example-rswebparts. WSP

As mentioned, the first steps are to rename the WSP to cab, and extract the contents to a folder.

You don't have to use izarc for this step; You cocould do using WinZip, or WinRAR-or even the default Windows Explorer.

 

Next-Go into the folder, and change whatever you need-such as DLL's or XML's, whatever.

For this example, I'm going to remove the language sets for De, es, FR, it (German, Spanish, French & Italian ).No reason-other than to 'invent' a change for this post-I don't have anything against the European Union-honest!

 

The next step is to create a new WSP-by re-cab 'ing these files-and here's the trick that caught me out.

You may be tempted to simply do CTRL-A-and then right-click> izarc> 'add to archive file'

But-This won't allow you do sub-folders-I don't know why !!

 

See...> !?!!?

 

Instead-the steps you need to do are these:

  1. Open izarc as a 'program'
  2. Create a new archive
  3. Choose a cab file type
  4. Add the files-and check the box for "subfolders"

-------

So-Let's give it a go:

  • Click Start> lzarc
  • Click new
  • Give the new archive a name-eg. newrswebparts (can change it later)

 

The next window has two tabs-Selection-AndOptions

  • Firstly select all the files you need for the new WSP-inSelectionTab
  • I chose the folder and then did CTRL-A to select all the files needed

 

Next-switch toOptionsTab>

  • Change the archive type to be "cab"
  • Check the box for "include sub-Folders"
  • Click OK

 

After half a milli-second, you'll have your new cab file.

  • Can then click the big red "exit" button-as we're re done with lzarc.
  • Switch back to Windows Explorer
  • Re-name the newly created cab file-> WSP extension.

 

And-that's it!

Only took a few steps to create a new WSP file-with updated contents-without needing Visual Studio-or WSP builder!

Just remember that you might need to update your initial projects back in TFs, or Visual Studio anyway.

This is just for those emergency updates-or if you don't have the source code/project.

Very nice indeed-very easy-and extremely useful!

Resource: http://sharepointroot.com/2010/07/07/editing-contents-of-a-wsp-sharepoint/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.