Wednesday, February 22, 2012

SharePoint 2010 - MSOCAF Prep Script

When operating on a hosted or Office 365 Dedicated (including BPOS-D) environment, you will need to utilize MSOCAF to both validate your code, do a test deployment, and submit to Microsoft.

With the following cmdlet, you’ll need to set two environmental variables, CAF_ANALYSIS_ROOT_PATH, CAF_SHORTCUT_PATH. Basically, this MSOCAF cmdlet, allows you to simplify the process of testing individual solutions during your development cycle. This cmdlet will copy the files to the necessary location and launch MSOCAF directly.
@echo off
SET WSP=SolutionName.wsp
SET PDB=SolutionName.pdb
SET CAF_ANALYSIS_ROOT_PATH=%CAF_ANALYSIS_ROOT_PATH%
SET CAF_SHORTCUT_PATH=%CAF_SHORTCUT_PATH%
@echo on
@echo.
cls
@echo.
@echo  Clearing Solutions artifacts folder…
rmdir /s /q %CAF_ANALYSIS_ROOT_PATH%”\Caf Reports”
rmdir /s /q %CAF_ANALYSIS_ROOT_PATH%”\Solutions artifacts\”
md %CAF_ANALYSIS_ROOT_PATH%”\Solutions artifacts\”
REM del /q %CAF_ANALYSIS_ROOT_PATH%”\Solutions artifacts\*.*”
@echo.
@echo  Copying files…
copy /y DeploymentFiles\%WSP% %CAF_ANALYSIS_ROOT_PATH%\”Solutions artifacts”
copy /y bin\Debug\%PDB% %CAF_ANALYSIS_ROOT_PATH%\”Solutions artifacts”
@echo.
@echo  Launching CAF…
%CAF_SHORTCUT_PATH%
@echo.
@echo  Done
pause
Post a Comment