Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Failed to modify resources" error #488

Closed
jnus opened this issue Nov 11, 2015 · 25 comments
Closed

"Failed to modify resources" error #488

jnus opened this issue Nov 11, 2015 · 25 comments

Comments

@jnus
Copy link

jnus commented Nov 11, 2015

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 #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?

@JakeGinnivan
Copy link

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

@anaisbetts
Copy link
Contributor

What happens when you run that command yourself?

@JakeGinnivan
Copy link

Works fine =/

@anaisbetts
Copy link
Contributor

@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

@JakeGinnivan
Copy link

λ 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

@anaisbetts
Copy link
Contributor

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.

@JakeGinnivan
Copy link

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
Copy link

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

@anaisbetts
Copy link
Contributor

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

@JakeGinnivan
Copy link

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

@anaisbetts
Copy link
Contributor

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

@svileng
Copy link

svileng commented Feb 3, 2016

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

@codesmithx
Copy link

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

@anaisbetts
Copy link
Contributor

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

@anaisbetts
Copy link
Contributor

@codesmithx provided the clue

@raybooysen
Copy link

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

@MickaelRizzello
Copy link

MickaelRizzello commented Jun 9, 2017

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.

@Thieum
Copy link
Contributor

Thieum commented Jun 15, 2017

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.

@ivoloshin
Copy link

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

cheshire137 added a commit to cheshire137/competiwatch-desktop that referenced this issue Sep 1, 2018
Got us past one error into the next one:

> Failed to modify resources
> Fatal error: Unable to set icon
>  at Squirrel.Update.Program

Looks like Squirrel/Squirrel.Windows#488
@darkzealot77
Copy link

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
Copy link

I go back to the 1.7.7 and it works. Don't really know why...

@darkzealot77
Copy link

It's don't work again. I try 1.7.5, 1.7.7 and the lastest 1.9.0.
Sometime it works. Sometimes not. The Setup.exe is read only before the use of rcedit.Exe and it fails :

Squirrel : System.AggregateException: Une ou plusieurs erreurs se sont produites. ---> System.Exception: Failed to modify resources, command invoked was:
'D:\dev\Gce.DevTools\PMMPowerTools_V2\packages\squirrel.windows.1.9.0\tools\rcedit.exe "D:\temp\PMMPowertools_Release\Setup.exe" --set-version-string "CompanyName" "EXM_PMM"
--set-version-string "LegalCopyright" "Copyright_IT-CE_2018" --set-version-string "FileDescription" "Outil_PMM" --set-version-string "ProductName" "Outil_PMM" --set-file-version 1.1.0
--set-product-version 1.1.0'
Au caractère D:\dev\Gce.DevTools\PMMPowerTools_V2\PMMPowerTools\Publication.ps1:67 : 1

  • Squirrel --releasify .$nugetPackName --releaseDir "D:\temp\PMMPowert ...
  •   + CategoryInfo          : NotSpecified: (System.Aggregat...-version 1.1.0':String) [], RemoteException
      + FullyQualifiedErrorId : NativeCommandError
    
    

Output was:
Fatal error: Unable to commit changes....

@darkzealot77
Copy link

I found the solution !
The squirrel package is checkin in TFS with my project and when I try to releasify squirrel copy the setup.exe in the directory, but setup.exe is read only !
So it's pretty simple, just need to checkout the files or copy the directory in an other location without source control.

@shiftkey
Copy link
Contributor

shiftkey commented May 7, 2019

Merging this into #888 which is about upgrading rcedit, but I'm hesitant that this will resolve it completely due to the various disparate discussion...

@shiftkey shiftkey closed this as completed May 7, 2019
@chihonjian
Copy link

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

replace place form ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests