@@ -42,9 +42,17 @@ for ($k = 0; $k -lt $packages.count; $k++) {
4242for ($i = 0 ;$i -lt $resources.Count ;$i ++ ) {
4343Write-Host Converting$resources [$i ].resource" ..."
4444if ($resources [$i ].newId) {
45- (Get-Content - LiteralPath$_.FullName )-replace $resources [$i ].oldId, $resources [$i ].newId| Set-Content - LiteralPath$_.FullName
46- Write-host " [Success]" - ForegroundColor Green- NoNewline
47- Write-host $ ($resources [$i ].resource) converted
45+ try {
46+ $content = Get-Content - LiteralPath$_.FullName - ErrorAction Stop
47+ $content -replace $resources [$i ].oldId, $resources [$i ].newId| Set-Content - LiteralPath$_.FullName
48+ Write-host " [Success]" - ForegroundColor Green- NoNewline
49+ Write-host $ ($resources [$i ].resource) converted
50+ }
51+ catch {
52+ Write-host " [Error]" - ForegroundColor Red- NoNewline
53+ Write-host " Failed to process file:$ ( $_.FullName ) "
54+ Write-host " Error:$_ " - ForegroundColor Red
55+ }
4856 }
4957else {
5058if ($resources [$i ].resource-match " .aspx" -eq $false ) {
@@ -73,7 +81,15 @@ for ($k = 0; $k -lt $packages.count; $k++) {
7381$files | ForEach-Object {
7482for ($i = 0 ;$i -lt $resources.Count ;$i ++ ) {
7583if ([System.String ]::IsNullOrEmpty($resources [$i ].newId)-eq $false ) {
76- (Get-Content - LiteralPath$_.FullName )-replace $resources [$i ].oldId, $resources [$i ].newId| Set-Content - LiteralPath$_.FullName
84+ try {
85+ $content = Get-Content - LiteralPath$_.FullName - ErrorAction Stop
86+ $content -replace $resources [$i ].oldId, $resources [$i ].newId| Set-Content - LiteralPath$_.FullName
87+ }
88+ catch {
89+ Write-host " [Error]" - ForegroundColor Red- NoNewline
90+ Write-host " Failed to process MSAPP file:$ ( $_.FullName ) "
91+ Write-host " Error:$_ " - ForegroundColor Red
92+ }
7793 }
7894else {
7995if ($resources [$i ].resource-match " .aspx" -eq $false ) {