说明:
前提是已完成代码编写工作;
一.直接copy法:
1.1.配置WebPart
即修改.dwp文件(XML格式的)
1.2信任WebPart
即编辑承载SPS站点的虚拟主机的根目录下的web.config文件
1.3部署WebPart
即将webpart项目产生的.dll程序集文件以及其它关联文件直接copy到 承载SPS站点的虚拟主机的根目录下的“bin”目录下;
1.4导入WebPart
即上载.dwp文件
以上步骤具体操作参见一步一步webpart-如何利用.net制作第一个webpart?(3)
二. 通过(.CAB)方式将WebPart部署到SPS服务器上
2.0下载 Cabinet Manager 2003 汉化版 http://ftp20.enet.com.cn:88/pub/fmanager/fcompress/HA_cab2003b_wjk.zip
2.1.配置WebPart
即修改.dwp文件(XML格式的)
2.2生成.CAB文件
将webpart项目产生的
.dll程序集文件
.dwp文件(WebPart描述文件)
Manifest.xml 文件 (WebPart部署文件)
以及其它关联文件
copy到一个文件夹,全选后点击右键=>"添加到Cabinet",弹出Cabinet Manager,如图所示:
保存,建议保存名称采用程序集名称,如图所示:
提示:我的cab文件在d盘根下
2.3部署WebPart
查看stsadm.exe是否在"C:\Program Files\Common Files\Microsoft Shared\web server extensions\60\BIN"下,如果在此目录下,将"C:\Program Files\Common Files\Microsoft Shared\web server extensions\60\BIN"添加到系统path中:
"我的电脑"=>"属性"=>"高级"=>"环境变量"=>
找到"path"=>"编辑",在末尾加分号";"再将"C:\Program Files\Common Files\Microsoft Shared\web server extensions\60\BIN"复制上去.确定即可!如图所示:
在"运行"中输入"CMD"弹出cmd.exe
输入一下语句:stsadm -o addwppack -filename webpart2.cab,如图所示:
三. 通过(.MSI)方式将WebPart部署到SPS服务器上
3.0下载 WebPart Packager
http://download.microsoft.com/download/4/3/f/43f63003-1d83-45ac-bb4f-3da9fa6ae487/WPPackagerSetup.exe
3.1解压到d:\WPPackager(共七个文件),将Manifest.xml,WebPart1.dwp和WebPart2.dll复制到此目录下
3.2编辑wppackager.xml配置文件,如下:
<?xml version="1.0" ?>
<Wppackager xmlns="http://schemas.microsoft.com/WebPart/v1/Wppackager">
<!--
The manifest node for specifying the manifest file. The manifest file has to be
present relative to the folder from which the tool is run.
-->
<!--编辑1:FileName=webpart的部署文件名-->
<Manifest FileName="Manifest.xml" />
<!--
The CodeAccessSecurity node contains the permission set to be applied to the
assembly specified in the AssemblyName attribute.
-->
<!--编辑2AssemblyName=webpart的程序集名:-->
<CodeAccessSecurity AssemblyName="WebPart2" Version="1.0.0.1" PublicKeyBlob="xxxxxxx" >
<!--
Note that these are the minimal permissions needed to run a web part plus the SharePoint
permission. More information about permissions that you can request for your web part
can be found at:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconcodeaccesspermissions.asp
and
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnspts/html/sharePoint_WSSCodeAccessSecurity.asp
-->
<PermissionSet class="NamedPermissionSet" version="1" >
<IPermission
class="System.Web.AspNetHostingPermission, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Level="Minimal"
/>
<IPermission
class="System.Security.Permissions.SecurityPermission, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Flags="Execution"
/>
<IPermission class="Microsoft.SharePoint.Security.WebPartPermission, Microsoft.SharePoint.Security, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"
version="1"
Connections="True"
/>
<IPermission class="Microsoft.SharePoint.Security.SharePointPermission, Microsoft.SharePoint.Security, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"
version="1"
ObjectModel="True"
/>
</PermissionSet>
</CodeAccessSecurity>
<!--
The MSI specific information. This determines the name of the MSI Installer and the Web
Part package that is created. The name of the Web Part package in this case will be
MyWebPart_Microsoft Corporation.cab. The total length of the MSI Name and Manufacturer
should be less than 225 characters.
-->
<!--编辑3:Name:打包后的.msi文件名;Version:版本;Manufacturer开发商信息-->
<MSI Name="MyWebPart2" Version="1.0.0.1" Manufacturer="LiYP" />
</Wppackager>
3.3生成.MSI安装包
如图所示:
3.4安装MyWebPart2.msi,如图所示:
3.5删除MyWebPart2.msi,如图所示: