Squirrel.Windows icon indicating copy to clipboard operation
Squirrel.Windows copied to clipboard

"Failed to modify resources" error

Open jnus opened this issue 11 years ago • 25 comments

I'm having problems running the releasify command in a powershell script, triggered by Octopus Deploy release management tool. I get the following error:

System.AggregateException: One or more errors occurred. ---> System.Exception: Failed to modify resources, command invoked was: '.\rcedit.exe "C:\inetpub\Debug-www-xxx-download.xxx.dk\DMSUninstall\Setup.exe" --set-version-string "CompanyName" "Jasper Nygaard" --set-version-string "LegalCopyright" "Copyright ⌐ 2015 Jasper Nygaard" --set-version-string "FileDescription" "Vaerktoej til at afinstallere xxx" --set-version-string "ProductName" "Vaerktoej til at afinstallere xxx" --set-file-version 2015.45.0.130 --set-product-version 2015.45.0.130'
Error    08:22:13
Output was:
Error    08:22:13
   at Squirrel.Update.Program.<setPEVersionInfoAndIcon>d__17.MoveNext()
Error    08:22:13
   --- End of inner exception stack trace ---
Error    08:22:13
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
Error    08:22:13
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
Error    08:22:13
   at Squirrel.Update.Program.<>c__DisplayClass9_0.<Releasify>b__10()
Error    08:22:13
   at Squirrel.Utility.<>c__DisplayClass8_0.<Retry>b__0()
Error    08:22:13
   at Squirrel.Utility.Retry[T](Func`1 block, Int32 retries)
Error    08:22:13
   at Squirrel.Utility.Retry(Action block, Int32 retries)
Error    08:22:13
   at Squirrel.Update.Program.Releasify(String package, String targetDir, String packagesDir, String bootstrapperExe, String backgroundGif, String signingOpts, String baseUrl, String setupIcon, Boolean generateMsi)
Error    08:22:13
   at Squirrel.Update.Program.executeCommandLine(String[] args)
Error    08:22:13
   at Squirrel.Update.Program.main(String[] args)
Error    08:22:13
   at Squirrel.Update.Program.Main(String[] args)
Error    08:22:13
---> (Inner Exception #0) System.Exception: Failed to modify resources, command invoked was: '.\rcedit.exe "C:\inetpub\Debug-www-dms-download.xxx.dk\DMSUninstall\Setup.exe" --set-version-string "CompanyName" "Jasper Nygaard" --set-version-string "LegalCopyright" "Copyright ⌐ 2015 Jasper Nygaard" --set-version-string "FileDescription" "Vaerktoej til at afinstallere xxx" --set-version-string "ProductName" "Vaerktoej til at afinstallere xxx" --set-file-version 2015.45.0.130 --set-product-version 2015.45.0.130'
Error    08:22:13
Output was:
Error    08:22:13
   at Squirrel.Update.Program.<setPEVersionInfoAndIcon>d__17.MoveNext()<---

If I run the obove mentioned rcedit command, it works (I think - no error). I see that this issue have been raised before in https://github.com/Squirrel/Squirrel.Windows/issues/204. Running Squirrel.Windows 1.2.1. The command looks like this;

& $Squirrel --releasify $Nupkg --releaseDir $ReleaseDir -Verbose -n "/a /f $here\Certificates\Prod\CodeSign\xxx.pfx /p $CodeSignPassword"

Any hints?

jnus avatar Nov 11 '15 07:11 jnus

I'm hitting the same issue when trying to specify a network share as a release directory. Am continuing investigation but if anyone has ideas they are welcome

JakeGinnivan avatar Jan 07 '16 07:01 JakeGinnivan

What happens when you run that command yourself?

anaisbetts avatar Jan 07 '16 07:01 anaisbetts

Works fine =/

JakeGinnivan avatar Jan 07 '16 07:01 JakeGinnivan

@JakeGinnivan Are you sure? Like, you checked the exit code? I suspect rcedit.exe is not exactly a paragon of software design when it comes to error reporting

anaisbetts avatar Jan 07 '16 07:01 anaisbetts

λ C:\Users\jginniva\_code\PriceBook\tools\squirrel\rcedit.exe "\\VMDEVOCT1\ApplicationPackages\PriceBook\Setup.exe" --set-version-string "CompanyName" "ABN Group" --set-version-string "LegalCopyright" "Copyright � 2016 ABN Group" --set-version-string "FileDescription" "PriceBook" --set-version-string "ProductName" "PriceBook" --set-file-version 0.0.0 --set-product-version 0.0.0
C:\Users\jginniva\_code\PriceBook [Squirrel ≡ +3 ~6 -0 !]
λ $LASTEXITCODE
0

JakeGinnivan avatar Jan 07 '16 07:01 JakeGinnivan

I mean, tbh, I'd just use a local directory as my releases dir then ROBOCOPY /MIR it back at the end of the build.

anaisbetts avatar Jan 07 '16 07:01 anaisbetts

Does it need to be able to see all the previous packages to generate the diffs (I am just using squirrel for the first time)?

JakeGinnivan avatar Jan 07 '16 07:01 JakeGinnivan

Or should I mirror to local, generate update, then mirror again?

JakeGinnivan avatar Jan 07 '16 07:01 JakeGinnivan

@JakeGinnivan It does, but you could just Robocopy the opposite way

anaisbetts avatar Jan 07 '16 07:01 anaisbetts

:+1: cool. Will do that instead, I have a feeling it is a weird caspol issue or something. Thanks

JakeGinnivan avatar Jan 07 '16 07:01 JakeGinnivan

At the end of the day, remember that Squirrel is very dumb, it's literally just NuGet packages and a RELEASES text file that you can easily generate. It's very easy to generate your own custom build around it, there is no magic

anaisbetts avatar Jan 07 '16 07:01 anaisbetts

I'm experiencing the same problem, when using the atom/grunt-electron-installer. There's an issue created there: atom/grunt-electron-installer#96 which might be related.

svileng avatar Feb 03 '16 16:02 svileng

I solved this by replacing the rcedit.exe with a fresh one from https://github.com/atom/node-rcedit/raw/master/bin/rcedit.exe

codesmithx avatar Aug 04 '16 08:08 codesmithx

Oh I see why, the version of rcedit I package doesn't support version #s > 255

anaisbetts avatar Aug 05 '16 07:08 anaisbetts

@codesmithx provided the clue

anaisbetts avatar Aug 05 '16 07:08 anaisbetts

@paulcbetts where do you see that the rcedit package doesn't support versions > 255? Is there a link?

raybooysen avatar Sep 20 '16 14:09 raybooysen

Same error on shared folder with the version 1.7.5. I tried to use https://github.com/atom/node-rcedit/raw/master/bin/rcedit.exe but same error (and i noticed that this rcedit is 900KB, but squirel rcedit is only 149 KB). I downgrade to version 1.5.2 which works fine for me. edit:Well, I just noticed that in fact it not work better, their is simply no error displayed, but the setup metadata's are not modified too.

MickaelRizzello avatar Jun 09 '17 13:06 MickaelRizzello

Same with 1.7,5 with a network shared folder. Had to do the copy back and forth trick and work in a local folder to make it work.

Thieum avatar Jun 15 '17 13:06 Thieum

I'm getting same error when trying to deploy over UNC path

ivoloshin avatar Jan 09 '18 17:01 ivoloshin

Hi, I have the same problem but I release in a directory on my computer. Here the log in SquirrelSetup.log :

2018-12-05 12:01:09> Program: Building embedded zip file for Setup.exe 2018-12-05 12:01:09> Program: Failed to update Setup.exe with new Zip file: System.Exception: Failed to write Zip to Setup.exe!

Setup: D:\PMMPowertools_Release\Setup.exe, Zip: C:\Users\S0089146\AppData\Local\Temp\tmp2C59.tmp Starting to read in Zip file! Updating Resource! Couldn't open setup.exe for writing

What I see is that the Setup.exe which is generated by squirrel has attribute Read Only. So it can't modify it. When I change it manually in the explorer and launch rcedit it works. But I don't have my zip in it.... Don't know what to do know :(

darkzealot77 avatar Dec 05 '18 11:12 darkzealot77