zoukankan      html  css  js  c++  java
  • [转]SharePoint 2010 WSP包部署过程中究竟发生什么?

    原文:http://yysyb123.blog.163.com/blog/static/192050472011103054150256/

    SharePoint 2010 WSP包部署过程中究竟发生什么?   

    在SharePoint 2010中,我们可以使用Visual Studio 2010轻松创建WSP包来安装Web Part, Event Handler, Application Page以及其他。非常方便,但是你有没有研究过在在整个过程中SharePoint究竟做了些什么?以下是我根据http://msdn.microsoft.com/library/aa544500(office.14).aspx这边官方文章翻译,以及做实验的结果。我是用的是PowerShell命令进行部署。

    在部署项目之前,看一下我的项目结构(这个项目主要是使用Feature的方式来部署Web part):

    SPS-SolutionDeploy-01

    使用VS2010打包的结果是生成一个WSP文件“SharePointWebPartProject.wsp”.

    第一步:向SharePoint添加解决方案包:

    Add-SPSolution -LiteralPath "C:\Deploy\SharePointWebPartProject.wsp"

    部署的结果是WSP包被部署到SharePoint的配置数据库中.(默认是SharePoint_Config)

    SQL 命令:

    select *  from dbo.Objects  where name='SharePointWebPartProject.wsp'

    如果你的输入没有错误的话,你可以查询到2条相关的记录。

    但是这个时候,数据还是仅仅存在于配置数据库中,我们还需要安装解决方案包。

    第二步:安装解决方案包:

    Install-SPSolution -Identity "SharePointWebPartProject.wsp" -WebApplication http://www.contoso.com  -GACDeployment

    那么这一步的结果是什么呢?那就是先解压WSP包,然后拷贝程序集,Ascx等文件到相应的目录下面。当然咱们部署的是Feature,你就可以在“C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\FEATURES” 文件夹下面找到Feature的相关文件。在“C:\Windows\assembly”中也可以找到程序的dll.

    如果你是多个Web前端怎么办?是不是还需要挨个部署?当然不需要了,Timer job会帮助你搞定这一切!

    第三步:激活Feature:

    Enable-SPFeature -Identity "SharePointWebPartProject_SharePointWebPartFeature" -Url http://www.contoso.com

    这里值得注意的是 Feature的名字可能和你想象的不一样。是“ProjectName_FeatureName”自动去掉中间的空格。当你使用命令行部署的时候,如果出现错误,不妨去“C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\FEATURES” 看一下这个feature叫什么名字。

    那么接下来你就可以向页面添加Web Part了!

    补充:以下是删除解决方案的一些Powershell 命令,仅供参考:

    Disable-SPFeature -Identity "SharePointWebPartProject_SharePointWebPartFeature" -Url http://www.contoso.com -Confirm:$false    Uninstall-SPSolution -Identity "SharePointWebPartProject.wsp" -WebApplication "http://www.contoso.com" -Confirm:$false  Remove-SPSolution -Identity "SharePointWebPartProject.wsp" -Confirm:$false

    参考:

    http://technet.microsoft.com/en-us/library/cc262995.aspx

    http://msdn.microsoft.com/library/aa544500(office.14).aspx

  • 相关阅读:
    SpringMVC中静态获取request对象 Spring中获取 HttpServletRequest对象【转载】
    springcloud 的loadbalancer 轮询算法切换方法 2021.4.3
    springboot项目启动增加图标
    rabbitmq 端口作用以及修改方法
    centos8 安装rabbitmq
    springcloud config client Value获取不到信息的问题的处理方法
    springcloud config配置git作为数据源然后启动报错 If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
    Sublime Text的列模式如何操作
    centos8 安装redis
    jQuery简单的Ajax调用
  • 原文地址:https://www.cnblogs.com/dosboy/p/2294852.html
Copyright © 2011-2022 走看看