woensdag 5 november 2008

Sharepoint: Upload Masterpage, CSS and Images with WSP

Manifest.XML

<?xml version="1.0" encoding="utf-8" ?>

<Solution xmlns="http://schemas.microsoft.com/sharepoint/" SolutionId="{91320A34-AC12-4ffa-8076-2ECFBD7BA686}" >

<FeatureManifests>

<FeatureManifest Location="StyleAndLayout.PL\Feature.xml"/>

</FeatureManifests>

<TemplateFiles>

<TemplateFile Location="Features\StyleAndLayout.PL\Style Library\en-us\Core Styles\BandOverC.Css"/>

<TemplateFile Location="Features\StyleAndLayout.PL\Style Library\fr-fr\Core Styles\BandOverC.Css"/>

<TemplateFile Location="Features\StyleAndLayout.PL\Style Library\nl-nl\Core Styles\BandOverC.Css"/>

<TemplateFile Location="Features\StyleAndLayout.PL\Style Library\CoreOverC.css"/>

<TemplateFile Location="Features\StyleAndLayout.PL\Style Library\IMAGES\Company\Company_bg_DegradeVertical.gif"/>

<TemplateFile Location="Features\StyleAndLayout.PL\Style Library\IMAGES\COMPANY\Company_bg_SelectList.gif"/>

<TemplateFile Location="Features\StyleAndLayout.PL\Style Library\IMAGES\COMPANY\Company_bullet.gif"/>

<TemplateFile Location="Features\StyleAndLayout.PL\Style Library\IMAGES\COMPANY\Company_bullet2.gif"/>

<TemplateFile Location="Features\StyleAndLayout.PL\Style Library\IMAGES\COMPANY\Company_Folder.gif"/>

<TemplateFile Location="Features\StyleAndLayout.PL\Style Library\IMAGES\COMPANY\Company_gr_Navbar_Gd_Default.jpg"/>

<TemplateFile Location="Features\StyleAndLayout.PL\Style Library\IMAGES\COMPANY\Company_gr_Navbar_Gd_Hover.jpg"/>

<TemplateFile Location="Features\StyleAndLayout.PL\Style Library\IMAGES\COMPANY\Company_Header_bg.gif"/>

<TemplateFile Location="Features\StyleAndLayout.PL\Style Library\IMAGES\COMPANY\Company_listheadergradgr.gif"/>

<TemplateFile Location="Features\StyleAndLayout.PL\Style Library\IMAGES\COMPANY\Company_Logo.gif"/>

<TemplateFile Location="Features\StyleAndLayout.PL\Style Library\IMAGES\COMPANY\Company_Page.gif"/>

<TemplateFile Location="Features\StyleAndLayout.PL\Style Library\IMAGES\COMPANY\Company_picture01.jpg"/>

<TemplateFile Location="Features\StyleAndLayout.PL\Style Library\IMAGES\COMPANY\Company_TiretG.GIF"/>

<TemplateFile Location="Features\StyleAndLayout.PL\Style Library\IMAGES\COMPANY\Company_Tiret.GIF"/>

<TemplateFile Location="Features\StyleAndLayout.PL\Master Page Gallery\COMPANY.master"/>

</TemplateFiles>

</Solution>

Wsp_structure

.OPTION EXPLICIT ; Generate errors

.Set CabinetNameTemplate="StyleAndLayout.wsp"

.set DiskDirectoryTemplate=CDROM ; All cabinets go in a single directory

.Set CompressionType=MSZIP;** All files are compressed in cabinet files

.Set UniqueFiles="ON"

.Set Cabinet=on

.Set DiskDirectory1="..\..\..\..\..\ExecuteScripts"

;CAB Manifest

.set DestinationDir=

..\Deploymentfiles\manifest.xml

;ASSEMBLY

;FEATURE MANIFEST

.set DestinationDir=StyleAndLayout.PL

..\Features\StyleAndLayout.PL\Feature.xml

..\Features\StyleAndLayout.PL\StyleAndLayout.pl.xml

;MASTERPAGES

.set DestinationDir=Features\StyleAndLayout.PL\Master Page Gallery

"..\Features\StyleAndLayout.PL\Master Page Gallery\COMPANY.master"

;CSS

.set DestinationDir=Features\StyleAndLayout.PL\Style Library

"..\Features\StyleAndLayout.PL\Style Library\CoreOverC.css"

.set DestinationDir=Features\StyleAndLayout.PL\Style library\en-us\Core Styles

"..\Features\StyleAndLayout.PL\Style Library\en-us\Core Styles\BandOverC.css"

.set DestinationDir=Features\StyleAndLayout.PL\Style library\fr-fr\Core Styles

"..\Features\StyleAndLayout.PL\Style Library\fr-fr\Core Styles\BandOverC.css"

.set DestinationDir=Features\StyleAndLayout.PL\Style library\nl-nl\Core Styles

"..\Features\StyleAndLayout.PL\Style Library\nl-nl\Core Styles\BandOverC.css"

;IMAGES

.set DestinationDir=Features\StyleAndLayout.PL\Style Library\IMAGES\COMPANY

"..\Features\StyleAndLayout.PL\Style Library\IMAGES\COMPANY\Company_bg_DegradeVertical.gif"

"..\Features\StyleAndLayout.PL\Style Library\IMAGES\COMPANY\Company_bg_SelectList.gif"

"..\Features\StyleAndLayout.PL\Style Library\IMAGES\COMPANY\Company_bullet.gif"

"..\Features\StyleAndLayout.PL\Style Library\IMAGES\COMPANY\Company_bullet2.gif"

"..\Features\StyleAndLayout.PL\Style Library\IMAGES\COMPANY\Company_gr_Navbar_Gd_Default.jpg"

"..\Features\StyleAndLayout.PL\Style Library\IMAGES\COMPANY\Company_gr_Navbar_Gd_Hover.jpg"

"..\Features\StyleAndLayout.PL\Style Library\IMAGES\COMPANY\Company_Header_bg.gif"

"..\Features\StyleAndLayout.PL\Style Library\IMAGES\COMPANY\Company_listheadergradgr.gif"

"..\Features\StyleAndLayout.PL\Style Library\IMAGES\COMPANY\Company_Logo.gif"

"..\Features\StyleAndLayout.PL\Style Library\IMAGES\COMPANY\Company_Page.gif"

"..\Features\StyleAndLayout.PL\Style Library\IMAGES\COMPANY\Company_picture01.jpg"

"..\Features\StyleAndLayout.PL\Style Library\IMAGES\COMPANY\Company_Folder.gif"

"..\Features\StyleAndLayout.PL\Style Library\IMAGES\COMPANY\Company_Tiret.gif"

"..\Features\StyleAndLayout.PL\Style Library\IMAGES\COMPANY\Company_TiretG.GIF"

Post-Build event command Line

call "$(ProjectDir)\DeploymentFiles\PostBuildActions.bat" "$(ConfigurationName)" "$(ProjectDir)" "$(ProjectName)" "$(TargetDir)" "$(TargetName)" DEPLOY

PostbuildActions.Bat

@ECHO OFF

:: -----------------------------------------------

::

:: --------------------------

:: Post build actions (VS):

:: --------------------------

:: This batch file is run by VS after the user builds the project (F6)

:: It installs a simple solution package to sharepoint. No feature is installed or activated.

:: Adapted by Michael Hofer, originally, this script is used with SharePoint Workflow VS Templates.

:: By default, it skips all deployment steps so that users can build without deploying.

:: Users can use the DEPLOY parameter to install the assembly the GAC and activate

:: stsadm deployment commands.

:: --------------------------

:: How to deploy:

:: --------------------------

:: 1. Sign the assembly

:: 2. Use "Release" mode for compilation

:: 3. Change "NODEPLOY" to "DEPLOY" in the post build events (in project properties,

:: see "Build Events"->"Post-build event command line")

:: 4. Make sure that the web application urls are set correctly (Ln 88 & 96)

:: 5. Press F6 or go to Build->(Re)Build Solution

:: --------------------------

:: Usage:

:: --------------------------

:: - Deployment disabled: call "$(ProjectDir)\DeploymentFiles\PostBuildActions.bat" "$(ConfigurationName)" "$(ProjectDir)" "$(ProjectName)" "$(TargetDir)" "$(TargetName)" NODEPLOY

:: - Deployment enabled: call "$(ProjectDir)\DeploymentFiles\PostBuildActions.bat" "$(ConfigurationName)" "$(ProjectDir)" "$(ProjectName)" "$(TargetDir)" "$(TargetName)" DEPLOY

:: -----------------------------------------------

::

ECHO.

ECHO Running post build actions.

ECHO.

:: e.g."Debug" or "Release"

SET CONFIG=%1

SET CONFIG=%CONFIG:~1,-1%

ECHO CONFIG: %CONFIG%

:: constant placeholder for branch logic comparison; always "DEPLOY"

SET CONFIGVALUE=Release

IF NOT %CONFIG%==%CONFIGVALUE% (ECHO Not in Release mode, skipping deployment & GOTO QUIT)

:: e.g. "C:\Projects\MySolution"

SET PROJECTDIR=%2

SET PROJECTDIR=%PROJECTDIR:~1,-2%

ECHO PROJECTDIR: %PROJECTDIR%

:: e.g. "C:\Projects\MySolution\DeploymentFiles"

SET DEPLOYMENTDIR=%PROJECTDIR%\DeploymentFiles

ECHO DEPLOYMENTDIR: %DEPLOYMENTDIR%

:: e.g. "MySolution"

SET PROJECTNAME=%3

SET PROJECTNAME=%PROJECTNAME:~1,-1%

ECHO PROJECTNAME: %PROJECTNAME%

:: e.g. "C:\Projects\MySolution\bin\Debug"

SET TARGETDIR=%4

SET TARGETDIR=%TARGETDIR:~1,-2%

ECHO TARGETDIR: %TARGETDIR%

:: e.g. "MySolution"(.dll)

SET TARGETNAME=%5

SET TARGETNAME=%TARGETNAME:~1,-1%

ECHO TARGETNAME: %TARGETNAME%

:: cmd parameter, e.g. "DEPLOY" or "NODEPLOY"

SET DEPLOY=%6

ECHO DEPLOY: %DEPLOY%

:: constant placeholder for branch logic comparison; always "DEPLOY"

SET DEPLOYVALUE=DEPLOY

ECHO DEPLOYVALUE: %DEPLOYVALUE%

IF NOT %DEPLOY%==%DEPLOYVALUE% (ECHO Skipping deployment & GOTO QUIT)

IF EXIST "%CommonProgramFiles%\Microsoft Shared\Web Server Extensions\12\BIN\STSADM.EXE" (SET STSADM="%CommonProgramFiles%\Microsoft Shared\Web Server Extensions\12\BIN\STSADM.EXE") ELSE (ECHO STSAMD.EXE could not be found! & GOTO QUIT)

ECHO.

ECHO Generating %PROJECTNAME%.wsp ...

ECHO.

makecab /f "%DEPLOYMENTDIR%\wsp_structure.ddf"

GOTO QUIT

ECHO.

ECHO Retracting and deleting solution (if it exists)...

ECHO.

%STSADM% -o retractsolution -name %PROJECTNAME%.wsp -url http://localhost:8081 -local

%STSADM% -o deletesolution -name %PROJECTNAME%.wsp

ECHO.

ECHO Adding and deploying the solution...

ECHO.

%STSADM% -o addsolution -filename "Package\%PROJECTNAME%.wsp"

%STSADM% -o deploysolution -name %PROJECTNAME%.wsp -url http://localhost:8081 -local -allowGacDeployment -force

GOTO FINISH

:: -----------------------------------------------

::

:FINISH

::

ECHO Doing an iisreset...

ECHO.

CALL iisreset

:: -----------------------------------------------

:: -----------------------------------------------

::

:QUIT

ECHO.

ECHO Done

ECHO.

::

:: -----------------------------------------------

Feature.XML

<?xml version="1.0" encoding="utf-8" ?>

<Feature xmlns="http://schemas.microsoft.com/sharepoint/"

Id="A9CEB138-B991-4013-A1F9-26C6BB646021"

Title="RollOut Style COMPANY"

Description="Custom action on Site Actions"

Version="1.0.0.0"

Scope="Site"

Hidden="False">

<ElementManifests>

<ElementManifest Location="StyleAndLayout.pl.xml" />

</ElementManifests>

</Feature>

Element.xml

<?xml version="1.0" encoding="utf-8" ?>

<Elements xmlns="http://schemas.microsoft.com/sharepoint/">

<Module Name="BandOverC Stylesheet"

Path="Style Library"

Url="Style Library/en-us/Core Styles">

<File Name="BandOverC.css"

Url="en-us/Core Styles/BandOverC.css"

Type="GhostableInLibrary"

IgnoreIfAlreadyExists="True"

NavBarHome="False" />

</Module>

<Module Name="BandOverC Stylesheet"

Path="Style Library"

Url="Style Library/fr-fr/Core Styles">

<File Name="BandOverC.css"

Url="fr-fr/Core Styles/BandOverC.css"

Type="GhostableInLibrary"

IgnoreIfAlreadyExists="True"

NavBarHome="False" />

</Module>

<Module Name="BandOverC Stylesheet"

Path="Style Library"

Url="Style Library/nl-nl/Core Styles">

<File Name="BandOverC.css"

Url="nl-nl/Core Styles/BandOverC.css"

Type="GhostableInLibrary"

IgnoreIfAlreadyExists="True"

NavBarHome="False" />

</Module>

<Module Name="CoreOverC Stylesheet"

Path="Style Library"

Url="Style Library">

<File Name="CoreOverC.css"

Url="CoreOverC.css"

Type="GhostableInLibrary"

IgnoreIfAlreadyExists="True"

NavBarHome="False" />

</Module>

<Module Name="Company_bg_DegradeVertical Image"

Path="Style Library"

Url="Style Library/Images/COMPANY">

<File Name="Company_bg_DegradeVertical.gif"

Url="IMAGES/COMPANY/Company_bg_DegradeVertical.gif"

Type="GhostableInLibrary"

IgnoreIfAlreadyExists="True"

NavBarHome="False" />

</Module>

<Module Name="Company_bg_SelectList"

Path="Style Library"

Url="Style Library/Images/COMPANY">

<File Name="Company_bg_SelectList.gif"

Url="IMAGES/COMPANY/Company_bg_SelectList.gif"

Type="GhostableInLibrary"

IgnoreIfAlreadyExists="True"

NavBarHome="False" />

</Module>

<Module Name="Company_bullet"

Path="Style Library"

Url="Style Library/Images/COMPANY">

<File Name="Company_bullet.gif"

Url="IMAGES/COMPANY/Company_bullet.gif"

Type="GhostableInLibrary"

IgnoreIfAlreadyExists="True"

NavBarHome="False" />

</Module>

<Module Name="Company_bullet2"

Path="Style Library"

Url="Style Library/Images/COMPANY">

<File Name="Company_bullet2.gif"

Url="IMAGES/COMPANY/Company_bullet2.gif"

Type="GhostableInLibrary"

IgnoreIfAlreadyExists="True"

NavBarHome="False" />

</Module>

<Module Name="Company_Folder"

Path="Style Library"

Url="Style Library/Images/COMPANY">

<File Name="Company_Folder.gif"

Url="IMAGES/COMPANY/Company_Folder.gif"

Type="GhostableInLibrary"

IgnoreIfAlreadyExists="True"

NavBarHome="False" />

</Module>

<Module Name="Company_gr_Navbar_Gd_Default"

Path="Style Library"

Url="Style Library/Images/COMPANY">

<File Name="Company_gr_Navbar_Gd_Default.jpg"

Url="IMAGES/COMPANY/Company_gr_Navbar_Gd_Default.jpg"

Type="GhostableInLibrary"

IgnoreIfAlreadyExists="True"

NavBarHome="False" />

</Module>

<Module Name="Company_gr_Navbar_Gd_Hover Image"

Path="Style Library"

Url="Style Library/Images/COMPANY">

<File Name="Company_gr_Navbar_Gd_Hover.jpg"

Url="IMAGES/COMPANY/Company_gr_Navbar_Gd_Hover.jpg"

Type="GhostableInLibrary"

IgnoreIfAlreadyExists="True"

NavBarHome="False" />

</Module>

<Module Name="Company_Header_bg Image"

Path="Style Library"

Url="Style Library/Images/COMPANY">

<File Name="Company_Header_bg.gif"

Url="IMAGES/COMPANY/Company_Header_bg.gif"

Type="GhostableInLibrary"

IgnoreIfAlreadyExists="True"

NavBarHome="False" />

</Module>

<Module Name="Company_listheadergradgr Image"

Path="Style Library"

Url="Style Library/Images/COMPANY">

<File Name="Company_listheadergradgr.gif"

Url="IMAGES/COMPANY/Company_listheadergradgr.gif"

Type="GhostableInLibrary"

IgnoreIfAlreadyExists="True"

NavBarHome="False" />

</Module>

<Module Name="Company_Logo Image"

Path="Style Library"

Url="Style Library/Images/COMPANY">

<File Name="Company_Logo.gif"

Url="IMAGES/COMPANY/Company_Logo.gif"

Type="GhostableInLibrary"

IgnoreIfAlreadyExists="True"

NavBarHome="False" />

</Module>

<Module Name="Company_Page Image"

Path="Style Library"

Url="Style Library/Images/COMPANY">

<File Name="Company_Page.gif"

Url="IMAGES/COMPANY/Company_Page.gif"

Type="GhostableInLibrary"

IgnoreIfAlreadyExists="True"

NavBarHome="False" />

</Module>

<Module Name="Company_picture01 Image"

Path="Style Library"

Url="Style Library/Images/COMPANY">

<File Name="Company_picture01.jpg"

Url="IMAGES/COMPANY/Company_picture01.jpg"

Type="GhostableInLibrary"

IgnoreIfAlreadyExists="True"

NavBarHome="False" />

</Module>

<Module Name="Company_Tiret Image"

Path="Style Library"

Url="Style Library/Images/COMPANY">

<File Name="Company_Tiret.gif"

Url="IMAGES/COMPANY/Company_Tiret.gif"

Type="GhostableInLibrary"

IgnoreIfAlreadyExists="True"

NavBarHome="False" />

</Module>

<Module Name="Company_TiretG Image"

Path="Style Library"

Url="Style Library/Images/COMPANY">

<File Name="Company_TiretG.GIF"

Url="IMAGES/COMPANY/Company_TiretG.GIF"

Type="GhostableInLibrary"

IgnoreIfAlreadyExists="True"

NavBarHome="False" />

</Module>

<Module Name="DemoMasterPage"

Path="Master Page Gallery"

Url="_catalogs/masterpage"

RootWebOnly="FALSE">

<File Url="COMPANY.master" Type="GhostableInLibrary" />

</Module>

</Elements>

Solution Structure Visual Studio

Solution structure On Filesystem

Geen opmerkingen: