公司经常会考虑在SharePoint中部署Solution来实现一些客制化的Feature,满足公司内部需求,这些Solution编写好后会build成文件,那要如何部署Solution到SharePoint Farm中呢?下面我们来看下具体的方法。
我们会介绍两种部署Solution的方式,分别是使用Command Prompt和SharePointManagement Shell实现:
- 方法一:Command Prompt
- Administrator方式打开Command Prompt;
- 执行命令修改默认路径为SharePoint Bin folder "…\Program Files\Common Files\microsoft shared\Web Server Extensions\15\BIN"
- 执行Add Solution命令:
stsadm-o addsolution -filename"Solution filename"
- 登录SharePoint Central Administration-> System Settings-> Manage Farm Solutions,可以看到Solution文件部署到SharePoint,但是还没有Deploy;
- 执行Deploy Solution命令,部署到需要的Web Application,如果有GAC、Policy等关联还需要加allow设置,这些根据需要填写;
stsadm-o deploysolution -name"solutionname" - url"web applicationurl" -immediate
- 此时刷新Step4中Solution Management页面,显示部署成功。
- 方法二:SharePoint Management Shell
- Administrator方式打开SharePoint Management Shell
- 用Add-SPSolution将Solution部署到SharePoint中:
Add-SPSolution "solution file name"
- 登录SharePoint Central Administration-> System Settings-> Manage Farm Solutions,可以看到Solution文件部署到SharePoint,但是还没有Deploy;
- 用Install-SPSolution deploy Solution到Web Application:
Install-SPSolution-Identity "solution name" -WebApplication "web applicationurl" -GACDeployment
- 此时刷新Step4中Solution Management页面,显示部署成功。
以上就是通过Command Prompt和SharePoint Management Shell两种方式部署Farm Solution到SharePoint的方法,感谢阅读!