Advertisement
Guest User

Untitled

a guest
Apr 29th, 2016
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.54 KB | None | 0 0
  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <Feature xmlns="http://schemas.microsoft.com/sharepoint/" Version="1.7.0.0">
  3. <UpgradeActions>
  4. <VersionRange BeginVersion="1.0.0.0" EndVersion="1.4.0.0">
  5. <ApplyElementManifests>
  6. <ElementManifest Location="module1Elements_v1_2.xml" />
  7. <ElementManifest Location="module2Elements_v1_3.xml" />
  8. </ApplyElementManifests>
  9. </VersionRange>
  10.  
  11. <VersionRange BeginVersion="1.7.0.0" >
  12. <ApplyElementManifests>
  13. <ElementManifest Location="module1Elements_v1_4.xml" />
  14. </ApplyElementManifests>
  15. </VersionRange>
  16.  
  17. <VersionRange>
  18. <CustomUpgradeAction Name="UpgradeElements" />
  19. </VersionRange>
  20. </UpgradeActions>
  21. </Feature>
  22.  
  23. <?xml version="1.0" encoding="utf-8"?>
  24. <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  25. <Module Name="ConnectionLauncher" Path="ProductNameConnectionLauncher" Url="ProductName/ConnectionLauncher">
  26. <File Path ="ProductName.Module1.dll" Url="ProductName.Module1.dll.deploy" IgnoreIfAlreadyExists="TRUE" Type="GhostableInLibrary" />
  27. <File Path="ProductName.Module2.dll" Url="ProductName.Module.dll.deploy"2 IgnoreIfAlreadyExists="TRUE" Type="Ghostable" />
  28. <File Path="ProductName.Module3.dll" Url="ProductName.Module3.dll.deploy" IgnoreIfAlreadyExists="TRUE" Type="GhostableInLibrary" />
  29. <File Path="ProductName.Module4.dll" Url="ProductName.Module4.dll.deploy" IgnoreIfAlreadyExists="TRUE" Type="Ghostable" />
  30. </Module>
  31. </Elements>
  32.  
  33. $fullName = "$featureName$version.wsp"
  34. $path = Get-Location
  35. $fullPath = "$path$fullName"
  36. Write-Host "Updating $fullPath"
  37.  
  38. 'check that it exists
  39. if(![System.IO.File]::Exists($fullPath)){
  40. # file with path $path doesn't exist
  41. Write-Error "The file $fullPath does not exist."
  42. exit
  43. }
  44.  
  45. Update-SPSolution -Identity $baseName -LiteralPath "$fullPath" -GACDeployment
  46.  
  47.  
  48. 'Now just wait for it to deploy
  49. Write-Host -NoNewline "Waiting for product deployment..."
  50. $Solution = get-SpSolution $Name
  51. while($Solution.JobExists)
  52. {
  53. sleep 2
  54. Write-Host -NoNewline "."
  55. $Solution = get-SpSolution $Name
  56. }
  57.  
  58. $webApp = [Microsoft.SharePoint.Administration.SPWebApplication]::Lookup("http://localhost")
  59. $features = $webApp.QueryFeatures($featureGuid, $true)
  60.  
  61. foreach($feature in $features){
  62. Write-Host ("Feature Version " + $feature.Version)
  63.  
  64. try
  65. {
  66. $feature.Upgrade($true)
  67. Write-Host ("Upgraded to Feature Version " + $feature.Version)
  68. }
  69. catch [Exception]
  70. {
  71. Write-Error ("Exception Upgrading")
  72. echo $_.Exception.GetType().FullName, $_.Exception.Message
  73. }
  74. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement