Vamos al directorio de nuestra solución WF
<Nombre solución>\DeploymentFiles\ProductionDeployment
Aquí encontraremos dos ficheros:
- Manifest.xml
- Wsp_structure.ddf
Primero hemos de dejar bonito el Manifest.xml asi que vamos a editarlo:
<?xml version="1.0" encoding="utf-8" ?>
<!-- Manifest for a solution package (wsp). To customize:
1) Replace NEW_GUID with a unique GUID
2) Replace "MyFeature" with the name of your own feature
3) Replace "MyTarget" with the name of your own target
-->
<Solution xmlns="http://schemas.microsoft.com/sharepoint/" SolutionId="NEW_GUID" >
<Assemblies>
<Assembly DeploymentTarget="GlobalAssemblyCache" Location="MyTarget.dll" />
</Assemblies>
<FeatureManifests>
<FeatureManifest Location="MyFeature\Feature.xml"/>
</FeatureManifests>
</Solution> |
Como bien dice los comentarios del fichero tenemos que reemplazar el new_guid con:
- Con el guid de la solución
- Con otro guid único creado a partir del guidgen (menú inicio->visual studio 2005 o 2008 /Visual Studio tolos/Simbolo del sistema de Visual Studio)
También hay que reemplazar el nombre de la dll con el nuestro. En principio, yo siempre hago coincidir con el nombre de la feature. Es decir, MyFeature y MyTarget valen lo mismo.
Una vez tengamos el manifest.xml a punto vamos a editar el fichero .ddf
;
;*************
; This ddf specifies the structure of the .wsp solution cab file. To customize this:
; 1. Replace "MyFeature" with the name of your own feature.
; 2. Add IP forms for the workflow at the bottom.
;*************
;
.OPTION EXPLICIT ; Generate errors
.Set CabinetNameTemplate=MyFeature.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=Package
"..\..\DeploymentFiles\ProductionDeployment\manifest.xml" manifest.xml
"..\..\DeploymentFiles\FeatureFiles\feature.xml" MyFeature\feature.xml
"..\..\DeploymentFiles\FeatureFiles\workflow.xml" MyFeature\workflow.xml
"MyTarget.dll" MyTarget.dll
;
;*** add IP forms
;"..\..\DeploymentFiles\FeatureFiles\MyForm.xsn" MyFeature\MyForm.xsn
;*** <the end> |
Aquí también tendremos que reemplazar MyTarget y MyFeature y poner bien el path de la dll que luego se instalará en la GAC.
Si tenemos formularios de tareas también debemos añadir-los aquí. A su vez si los formularios de tareas tienen código también debemos poner sus dll correspondientes.
Un fichero de ejemplo quedaría de la siguiente forma:
;
;*************
; This ddf specifies the structure of the .wsp solution cab file. To customize this:
; 1. Replace "LiquidacionViajes" with the name of your own feature.
; 2. Add IP forms for the workflow at the bottom.
;*************
;
.OPTION EXPLICIT ; Generate errors
.Set CabinetNameTemplate=LiquidacionViajes.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=Package
"..\..\DeploymentFiles\ProductionDeployment\manifest.xml" manifest.xml
"..\..\DeploymentFiles\FeatureFiles\feature.xml" LiquidacionViajes\feature.xml
"..\..\DeploymentFiles\FeatureFiles\workflow.xml" LiquidacionViajes\workflow.xml
"..\..\bin\Release\LiquidacionViajes.dll" LiquidacionViajes.dll
;
;*** add IP forms
"..\..\DeploymentFiles\FeatureFiles\AutorizacionGasto.xsn" LiquidacionViajes\AutorizacionGasto.xsn
"..\..\DeploymentFiles\FeatureFiles\AutorizacionSGEF.xsn" LiquidacionViajes\AutorizacionSGEF.xsn
"..\..\DeploymentFiles\FeatureFiles\AutorizacionSGEF.dll" LiquidacionViajes\AutorizacionSGEF.dll
"..\..\DeploymentFiles\FeatureFiles\LiquidViajeModificable.xsn" LiquidacionViajes\LiquidViajeModificable.xsn
"..\..\DeploymentFiles\FeatureFiles\LiquidViajeModificable.dll" LiquidacionViajes\LiquidViajeModificable.dll
"..\..\DeploymentFiles\FeatureFiles\Microsoft.Office.Samples.ECM.Activities.dll"
LiquidacionViajes\Microsoft.Office.Samples.ECM.Activities.dll
;*** <the end> |
Ahora ya podremos hacer la compilación:
Creamos un commandwindows (menú inicio->ejecutar->cmd) y nos vamos con el path donde está el fichero .ddf
En este punto ejecutamos el comando:
makecab /f wsp_structure.ddf
|
Esto nos creara un subdirectorio llamado Package donde contendrá nuestra solución WSP.
Para ver que tiene correctamente nuestros ficheros copiamos y pegamos el fichero haciendo una copia del mismo.
Renombramos la copia a extensión .cab y así podremos ver el contenido para comprobar que tenga todos los ficheros.
Para instalar la feature vamos a crear un script . Aparte de instalar la feature debemos copiar los xsn y las dll: install.bat
echo Copying the feature...
rd /s /q "%CommonProgramFiles%\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES\LiquidacionViajes"
mkdir "%CommonProgramFiles%\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES\LiquidacionViajes"
copy /Y feature.xml "%programfiles%\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES\LiquidacionViajes\"
copy /Y workflow.xml "%programfiles%\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES\LiquidacionViajes\"
xcopy /s /Y *.xsn "%programfiles%\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES\LiquidacionViajes\"
xcopy /s /Y *.dll "%programfiles%\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES\LiquidacionViajes"
ECHO.
ECHO Adding and deploying the solution...
ECHO.
STSADM -o addsolution -filename LiquidacionViajes.wsp"
STSADM -o deploysolution -name LiquidacionViajes.wsp -local -allowGacDeployment -force
ECHO.
ECHO Activating and installing the feature...
ECHO.
STSADM -o installfeature -filename LiquidacionViajes\feature.xml -force
STSADM -o activatefeature -filename LiquidacionViajes\feature.xml -url http://moss/sites/WorkFlows -force
::echo Doing an iisreset...
::popd
::iisreset |
Para desinstalar haremos otro script: uninstall.bat
ECHO.
ECHO Deactiviating and uninstalling the feature...
ECHO.
STSADM -o deactivatefeature -filename LiquidacionViajes\feature.xml -url http://moss/sites/WorkFlows -force
STSADM -o uninstallfeature -filename LiquidacionViajes\feature.xml -force
ECHO.
ECHO Retracting and deleting solution (if it exists)...
ECHO.
STSADM -o retractsolution -name LiquidacionViajes.wsp -local
STSADM -o deletesolution -name LiquidacionViajes.wsp |