代码之家  ›  专栏  ›  技术社区  ›  Loofer

是否可以使用持续集成技术为SharePoint开发?

  •  6
  • Loofer  · 技术社区  · 15 年前

    我们正在准备一些相当严肃的SharePoint(Moss 2007)开发,包括自定义Web部件、列表、母版页和布局等。

    我们正在评估版本控制,似乎讨论还没有深入到这个程度。我希望我们能够轻松地从源代码管理部署到我们的测试和生产服务器,尽可能少地与人接触,最好在每次签入之后完全自动部署。

    我以前没有使用过CI,所以我对SharePoint可能的功能和过于复杂而不明智的功能感到有点无知。

    我担心,如果我们走上一条过于“简单”的道路,那么当我们在发布一些新功能后花半天时间来设置每个环境时,我们会很快后悔。

    我甚至还没有开始在我的头脑中思考当用户添加列表中有实际内容时会发生什么,以及这将如何影响我们在开发方面所做的工作。

    欢迎链接到博客/文档。个人体验非常受欢迎。

    3 回复  |  直到 14 年前
        1
  •  5
  •   Nat    15 年前

    我最有经验的是一个项目 STSDEV 为发布构建解决方案。自定义生成操作允许我们从目标服务器中删除SharePoint解决方案,安装新的解决方案并重置所需的应用程序池。

    建造花了一段时间,但效果很好。 我们并没有使用这个过程发布测试,但这可能是可能的。

    下面是一个目标文件的示例。不幸的是,它有点复杂。

    <?xml version="1.0" encoding="utf-8" ?>
    <Project DefaultTargets="DebugBuild" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    
      <PropertyGroup>
        <PackageName>MyFeatures.wsp</PackageName>
        <PackageFile>MyFeatures.wsp</PackageFile>
        <TargetUrl>http://intranet</TargetUrl>
        <ProjectDeploymentFilesFolder>DeploymentFiles</ProjectDeploymentFilesFolder>
        <ProjectRootFilesFolder>$(ProjectDir)\RootFiles</ProjectRootFilesFolder>
        <WssRootFilesFolder>$(ProgramFiles)\Common Files\Microsoft Shared\web server extensions\12</WssRootFilesFolder>
        <ReleaseFolder>$(SolutionDir)Deployment</ReleaseFolder>
        <MAKECAB>"C:\Windows\System32\makecab.exe"</MAKECAB>
        <STSADM>"$(ProgramFiles)\Common Files\Microsoft Shared\web server extensions\12\bin\stsadm.exe"</STSADM>
        <STSDEV>"$(SolutionDir)..\Tools\STSDev\stsdev.exe"</STSDEV>
        <GACUTIL>"C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\gacutil.exe"</GACUTIL>
        <IISAPP>cscript c:\windows\system32\iisapp.vbs</IISAPP>    
        <WARMUPSITE>"$(SolutionDir)..\Tools\WarmUpServer\AsyncWarmup.bat" "$(SolutionDir)..\Tools\WarmUpServer\"</WARMUPSITE>
        <TIMERJOBSRESTART>net stop SPTimerV3 &amp; net start SPTimerV3</TIMERJOBSRESTART>
      </PropertyGroup>
    
      <ItemGroup>
        <WSSSourceFiles Include="$(ProjectDir)\RootFiles\**\*.*" />
      </ItemGroup>  
    
    <Target Name="DebugBuild">
      <Message Text="Refreshing Deployment Files..." Importance="high" />
      <Exec Command="$(STSDEV) /refresh $(TargetName) $(ProjectDir)" ContinueOnError="true" />
      <Message Text="Deleting Solution Package File..." Importance="high" />
      <Delete Files="$(ProjectDeploymentFilesFolder)\$(PackageFile)" ContinueOnError="true" />
      <Message Text="Building Solution Package (Debug Version)" Importance="high" />
      <Exec Command="$(MAKECAB) /F $(ProjectDir)\$(ProjectDeploymentFilesFolder)\SolutionPackage.ddf /D CabinetNameTemplate=$(PackageFile)" ContinueOnError="false" />
      <Message Text="" Importance="high" />
      <Message Text="Copying WSP file to CAB" Importance="high" />
      <Delete Files="$(ProjectDeploymentFilesFolder)\$(PackageFile).cab" ContinueOnError="true" />
      <Copy SourceFiles="$(ProjectDeploymentFilesFolder)\$(PackageFile)" DestinationFiles="$(ProjectDeploymentFilesFolder)\$(PackageFile).cab" SkipUnchangedFiles="false" />
      <Message Text="Copying WSP file to release folder: $(ReleaseFolder) from $(ProjectDeploymentFilesFolder)\$(PackageFile)" Importance="high" />
      <Exec Command="attrib -r &quot;$(ReleaseFolder)\$(PackageFile)&quot;" ContinueOnError="true"></Exec>
      <Delete Files="$(ReleaseFolder)\$(PackageFile)" ContinueOnError="true" />
      <Copy SourceFiles="$(ProjectDeploymentFilesFolder)\$(PackageFile)" DestinationFolder="$(ReleaseFolder)" SkipUnchangedFiles="false" />
      <Message Text="" Importance="high" />
    </Target>
    
    <Target Name="DebugInstall" DependsOnTargets="DebugBuild">
      <Message Text="Installing Solution..." Importance="high" />
      <Exec Command="$(STSADM) -o addsolution -filename $(ProjectDeploymentFilesFolder)\$(PackageFile)" ContinueOnError="true" />
      <Exec Command="$(STSADM) -o execadmsvcjobs" />
      <Message Text="" Importance="high" />
    </Target>
    
    <Target Name="DebugDeploy" DependsOnTargets="DebugInstall">
      <Message Text="Deploying Solution..." Importance="high" />
      <Exec Command="$(STSADM) -o deploysolution -name $(PackageName) -immediate -allowgacdeployment -url http://intranet" />
      <Exec Command="$(STSADM) -o execadmsvcjobs" />
      <Copy SourceFiles="$(TargetDir)$(TargetName).pdb" DestinationFolder="C:\WINDOWS\assembly\GAC_MSIL\MyFeatures\1.0.0.0__ce271be627d58c77" SkipUnchangedFiles="" />
      <Message Text="$(TargetDir)$(TargetName).pdb copied to GAC for debugging." Importance="high" />
      <Message Text="" Importance="high" />
    </Target>
    
    <Target Name="DebugDeployForce" DependsOnTargets="DebugInstall">
      <Message Text="Deploying Solution..." Importance="high" />
      <Exec Command="$(STSADM) -o deploysolution -name $(PackageName) -immediate -allowgacdeployment -url http://intranet -force" />
      <Exec Command="$(STSADM) -o execadmsvcjobs" />
      <Copy SourceFiles="$(TargetDir)$(TargetName).pdb" DestinationFolder="C:\WINDOWS\assembly\GAC_MSIL\MyFeatures\1.0.0.0__ce271be627d58c77" SkipUnchangedFiles="" />
      <Message Text="$(TargetDir)$(TargetName).pdb copied to GAC for debugging." Importance="high" />
      <Message Text="" Importance="high" />
    </Target>
    
    <Target Name="DebugRedeploy" >
      <Message Text="" Importance="high" />
      <Message Text="Starting sequence of Retract/Delete/Build/Install/Deploy" Importance="high" />
      <CallTarget Targets="DebugRetract" />
      <CallTarget Targets="DebugDelete" />
      <CallTarget Targets="DebugBuild" />
      <CallTarget Targets="DebugInstall" />
      <CallTarget Targets="DebugDeployForce" />
      <Message Text="" Importance="high" />
    </Target>      
    
      <Target Name="DebugRetract" >
      <Message Text="Retracting Solution" />
      <Exec Command="$(STSADM) -o retractsolution -name $(PackageName) -immediate -url http://intranet" ContinueOnError="true" />
      <Exec Command="$(STSADM) -o execadmsvcjobs" />
      <Message Text="" Importance="high" />
    </Target>
    
    <Target Name="DebugDelete" DependsOnTargets="DebugRetract">
      <Message Text="Deleting Solution Package from Farm Solution Package Store" />
      <Exec Command="$(STSADM) -o deletesolution -name $(PackageName)" ContinueOnError="true" />
      <Exec Command="$(STSADM) -o execadmsvcjobs" />
      <Message Text="" Importance="high" />
    </Target>
    
       </Project>
    
        2
  •  3
  •   webwires    15 年前

    查看PowerShell…不幸的是,这是SharePoint的主要难题之一,它缺乏良好的开发和部署过程。一切都应该打包成解决方案并通过PowerShell部署,PowerShell还可以管理任何信息清理。要进行版本设置,只需将解决方案部署为升级,并根据需要使用PowerShell在应用程序中进行更新(如果更新了版本号)。这是许多额外的工作,但工作得很好。在最近的一次升级中,我不得不对两个Web部件进行版本设置,然后使用PowerShell循环访问所有~1500个我的网站,删除旧的Web部件并重新添加新的Web部件。

    您应该开始开发一个强大的PowerShell库来执行强大的更新任务。

        3
  •  1
  •   Maxime Rouiller    15 年前

    唯一与SharePoint进行某种持续集成的方法是使用功能和解决方案包(WSP)。

    您只需要用所有必要的文件/dll和配置打包您的wsp,然后部署它。部署后,您可以创建一个批处理脚本来自动重新激活所有功能。

    请注意,所有已自定义(未托管)的文件将不会更新。您必须确保重置为站点定义(通过代码它是“spfile.revertContentStream”)。

    祝你好运!