Error in UI-path when upgrading from EPiServer 5 to 6

The other day we were upgrading a site for a customer from EPiServer 5 to EPiServer 6. In the upgrade process an exception was thrown telling us:

At C:\Program Files (x86)\EPiServer\CMS\6.0.530.0\Upgrade\System Scripts\Upgrade Site (SqlServer).ps1:361 char:29

+                  $newUiUrl = $uiUrl.Replace <<<< ($uiPath, $uiPath+”/CMS”)

System.Management.Automation.ParentContainsErrorRecordException: Cannot convert argument “1”, with value: “/CMS”, for “Replace” to type “System.Char”: “Cannot convert value “/CMS” to type “System.Char”. Error: “Strängen måste vara exakt ett tecken lång.””

After some research we realized that the uiUrl in episerver.config was set to https://www.somedomain.com/ui/ and the upgrade script didn’t like it and most likely expected the value to be ~/ui/.

The solution was to change it to ~/ui/ during upgrade and then change it back.