For SharePoint - getting the contents of Solution files (*.wsp)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rpawliko
    Visitor
    • Nov 2014
    • 8

    For SharePoint - getting the contents of Solution files (*.wsp)

    I had a need to get the CRC's of the files distributed in SharePoint solutions. BeyondCompare doesn't know how to look inside a .wsp file, but a .wsp file has the same structure as a .cab file, and BC can read the contents of a cab file.

    (Note to ScooterSoftware - it would be helpful if you could inform BC that a .wsp file is a type of archive, identical to .cab files)

    In our development environment, we deploy multiple solutions in a given release. I created a batch file that renames all the .wsp files extension to .cab, creates a snapshot of the directory, and then renames the files extension back from .cab to .wsp.

    Following is the barebones example (no guarantee stated or implied!)

    Predeployment Snapshot batch file

    echo off
    SETLOCAL ENABLEEXTENSIONS

    REM set snapshot logfile
    set snapshotlog=%CD%\Logs\snapshotlog.txt

    REM set deployment directory to current directory
    set deploydir=%CD%

    REM set snapshot output file
    set snapshotfile="%CD%\Logs\Snapshot.bcss"

    REM rename all solution files to cab files
    for /r %deploydir% %%x in (*.wsp) do ren "%%x" *.cab

    REM call snapshot batch file
    call snapshot.bat

    REM rename all cab files to wsp files
    for /r %deploydir% %%x in (*.cab) do ren "%%x" *.wsp

    snapshot.bat:

    setlocal
    set path="C:\Program Files (x86)\Beyond Compare 4";%path%

    Bcompare.exe /silent "@C:\Program Files (x86)\Beyond Compare 4\snapshotscript.txt" %snapshotlog% %deploydir% %snapshotfile%

    endlocal
    exit /b

    REM end snapshot.bat


    Snapshot Script (snapshotscript.txt):

    #Log output
    log verbose append:"%1"

    #Capture directory contents to snapshot file
    snapshot save-crc save-version no-filters expand-archives path:"%2" output:"%3"
  • Aaron
    Team Scooter
    • Oct 2007
    • 16000

    #2
    Hello,

    We have not tested against .wsp files, but you can add it to the CAB format if they are actually identical/renamed. To test this, I would suggest first renaming your .wsp to .cab and checking to see if this allows it be extracted by BC and other archive software. If this works, you can go to the Tools menu -> Options, Archive types list, and add the .wsp extension to the Microsoft Cabinet (or any other) archive type. Then restart the application to apply this change.

    Please test this first in the graphical interface before incorporating into a script. Scripting runs automatically and does not provide the same level of feedback we can include in the main interface.
    Aaron P Scooter Software

    Comment

    Working...