以下以一个工作流部署为例
第一步
创建一个你的wsp包的目录名字,我创建的目录SharePointSequentialWorkflow(生成的wsp包名字是和这个目录名一样,可以随意,不会影响在Features下的目录名),然后将WSPBuilder包解开,所有文件都放到里面。
第二步
运行WSPBuilder -Createfolders [12|80|GAC|All],如果缺省不带参数,那么会创建如同Sharepoint的相同机构的目录结构,如下图
第三步
放置文件以便WSPBuilder生成包,这个过程和不使用工具部署一样,比如要部署一个工作流,工作流的手工部署过程是在Features目录下创建一个自己的目录,如SharePointSequentialWorkflow,然后把Form表单和workflow.xml,Feature.xml文件拷贝进去,注意表单如果放在下层目录(是由Feature.xml设定<ElementFile Location="Forms\AssociationInitiationForm.xsn"/>)那么就要创建相应的目录,表单是放在这个目录下。本例的表单是放在Forms下。用WSPBuilder自动生成部署包的过程与手工部署一样,要在Features目录下建立你的Features名字目录,放置要部署的文件,把程序集的Dll放到GAC目录下。
然后运行WSPBuilder就会生成SharePointSequentialWorkflow.wsp。
第四步
部署,使用WSPDeploy.exe SharePointSequentialWorkflow.wsp,但部署前必须删除原来的解决方案,否则会报错
删除解决方案方法
删除解决方案前必须回收解决方案,并要制定从部署目的的Web站点收回,否则报如下错误
已在该服务器场中部署解决方案“SharePointSequentialWorkflow.wsp”。请收回部署,然后删除此解决方案。您还可以使用 -override 参数强制删除此解决方案,但是将无法收回
解决方案部署。
stsadm -o retractsolution -name SharePointSequentialWorkflow.wsp -url http://localhost:8080 -immediate
可以不用-url参数,而用 -allcontenturls
stsadm -o retractsolution -allcontenturls -name SharePointSequentialWorkflow.wsp -immediate
使用-override强制删除解决方案,并不能回收
stsadm -o deletesolution -name SharePointSequentialWorkflow.wsp -override
手工增加部署解决方案方法
stsadm -o addsolution -filename SharePointSequentialWorkflow.wsp
解决方案需要在全局程序集缓存(GAC)中安装程序集。如果完全信任此解决方案,请使用 -allowGacDeployment 参数进行部署。
stsadm -o deploysolution -name SharePointSequentialWorkflow.wsp -url http://localhost:8080 -immediate -allowGacDeployment -force
可以不用-url参数,用-allcontenturls部署到所有站点
stsadm -o deploysolution -name SharePointSequentialWorkflow.wsp -allcontenturls -immediate -allowGacDeployment -force
部署之后再Feature下才出现相应目录
安装Feature
stsadm.exe -o installfeature -name SharePointSequentialWorkflow -force
激活Feature
stsadm -o activatefeature -filename SharePointSequentialWorkflow\feature.xml -url http://brucelee:8080 -force
回收Feature
STSADM -o deactivatefeature -filename SharePointSequentialWorkflow\feature.xml -url http://brucelee:8080 -force
卸载Feature
STSADM -o uninstallfeature -filename SharePointSequentialWorkflow\feature.xml -force
工作流workflow.xml解释
<?xml version="1.0" encoding="utf-8" ?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<Workflow
Name="知识审批工作流" ------出现创建工作流时选择框,也就是工作流模板名字
Description="知识审批工作流."
Id="59C6C175-617F-46ad-A6B1-EABFE6377D17"
CodeBesideClass="com.foresee.DM_Workflow.Workflow1"
CodeBesideAssembly="com.foresee.DM_Workflow, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0526d8e842610f19"
TaskListContentTypeId="0x01080100C9C9515DE4E24001905074F980F93160"
AssociationUrl="_layouts/CstWrkflIP.aspx"
InstantiationUrl="_layouts/IniWrkflIP.aspx"
ModificationUrl="_layouts/ModWrkflIP.aspx">
<Categories/>
<!-- Tags to specify InfoPath forms for the workflow; delete tags for forms that you do not have -->
<MetaData>
<Association_FormURN>urn:schemas-microsoft-com:office:infopath:InitForm:-myXSD-2007-01-22T05-01-39</Association_FormURN>
<Instantiation_FormURN>urn:schemas-microsoft-com:office:infopath:InitForm:-myXSD-2007-01-22T05-01-39</Instantiation_FormURN>
<Task0_FormURN>urn:schemas-microsoft-com:office:infopath:DM001TaskForm:-myXSD-2007-10-16T06-42-41</Task0_FormURN>
<Task1_FormURN>urn:schemas-microsoft-com:office:infopath:DM002TaskForm:-myXSD-2007-10-17T01-15-57</Task1_FormURN>
<StatusPageUrl>_layouts/WrkStat.aspx</StatusPageUrl>
</MetaData>
</Workflow>
</Elements>
工作流feature.xml解释
<?xml version="1.0" encoding="utf-8" ?>
<Feature Id="BF6A8DFD-835D-4b82-A5AD-275BB788C42E"
Title="知识审批工作流" --------出现在网站级功能列表中显示的名字
Description="知识审批工作流"
Version="12.0.0.0"
Scope="Site"
ReceiverAssembly="Microsoft.Office.Workflow.Feature, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"
ReceiverClass="Microsoft.Office.Workflow.Feature.WorkflowFeatureReceiver"
xmlns="http://schemas.microsoft.com/sharepoint/">
<ElementManifests>
<ElementManifest Location="workflow.xml" />
</ElementManifests>
<Properties>
<Property Key="GloballyAvailable" Value="true" />
<!-- Value for RegisterForms key indicates the path to the forms relative to feature file location -->
<!-- if you don't have forms, use *.xsn -->
<Property Key="RegisterForms" Value="*.xsn" />
</Properties>
</Feature>