Sign up ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Is it possible to set the start url of a High Trust App at deployment time?

From what I can tell it looks like this the url from app manifest gets hard coded into a binary .app file at compile time.

I would like to be able to set this url at deployment time to the each environments url when it is deployed (integration, qa, prod). Is this possible.

I have looked at Import-SPAppPackage and Install-SPApp but was not able to find anything.

share|improve this question

2 Answers 2

I was looking for this as well and I couldn't find anything either. I ended up writing a little app to unzip the .app file change the value of the start url and then zipping it back up with the same app name. Then deploying this .app to sharepoint with the url i wanted.

share|improve this answer
If you have a new question, please ask it by clicking the Ask Question button. Include a link to this question if it helps provide context. – Benny Skogberg Oct 18 '13 at 19:08

There are two options -

  1. Redeploy your app with new URL.
  2. Use PS to update the URL in the app manifest.

PS for option 2 -

 Function Update-AppManifest($appPackage, $oldUrl, $newUrl)
   Add-Type -Path (Get-ChildItem "WindowsBase.dll")

   Write-Host "Opening app package '$appPackage'"

   $package = [System.IO.Packaging.Package]::Open($appPackage, [System.IO.FileMode]::Open)
   $manifestUri = New-Object System.Uri("/AppManifest.xml", [System.UriKind]::Relative)
   $partNameUri = [System.IO.Packaging.PackUriHelper]::CreatePartUri($manifestUri)
   $part = $package.GetPart($partNameUri)
   $partStream = $part.GetStream()

   Write-Host "Reading app package"
   $reader = New-Object -Type System.IO.StreamReader -ArgumentList $partStream
   $content = $reader.ReadToEnd()

   Write-Host "===================== START: Contents before Replace ====================="
   echo $content
   Write-Host "===================== END: Contents before Replace ====================="

   Write-Host "Replacing the content '$oldUrl' with '$newUrl'"
      $content = $content.Replace($oldUrl, $newUrl)

   Write-Host "===================== START: Contents AFTER Replace ====================="
   echo $content
   Write-Host "===================== END: Contents AFTER Replace ====================="

   $partStream.Position = 0

   Write-Host "Updating the package file"
   $writer = New-Object -TypeName System.IO.StreamWriter -ArgumentList $partStream


   Write-Host "Package updated and closed."

 $purana = "https://puranaurl"
 $naya = "https://nayaurl"
 $appPackage = "path2app"

 Update-AppManifest $appPackage $purana $newUrl

Note - you will need reference to windowsbase.dll for unzipping and updating the app.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.