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 would not allow it to be deployed (which is a good thing !)
My thinking was to just ‘remove’ 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 way to simply modify 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 !!
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 – these don’t work :
- 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 !
About the only way that I could 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 :
- Rename the WSP to CAB
- Extract all contents to a folder – using Windows Explorer, or WinZip, WinRAR, or whatever
- Change the items you want, ie. MANIFEST.XML and remove a DLL (in my case)
- Create a new CAB file with the updated contents, using IZARC
- Rename the newly created CAB to WSP
- 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 could 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 !!
Instead – the steps you need to do are these :
- Open IZArc as a ‘program’
- Create a new archive
- Choose a CAB file type
- 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 – and Options
- Firstly select all the files you need for the new WSP – in the Selection tab
- I chose the folder and then did CTRL-A to select all the files needed
NEXT – switch to the Options tab >
- 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 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 !