Wednesday, December 03, 2008

Sitecore Packager throwing System.IO.IOException: The file exists.

Just had a bit of a curiosity when attempting to create a package using the Sitecore Packager.
Essentially it would give up on me, and tell me that the file existed. Stacktrace revealed:

[IOException: The file exists.] System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) +2056933 System.IO.__Error.WinIOError() +30 System.IO.Path.GetTempFileName() +2715024 Sitecore.Shell.Applications.Install.Commands.BuildPackageCommand.Execute(CommandContext context) +106

And so on. So looking at this, turns out the packager isn't really to blame here. Except maybe for the fact that it should have cought this exception and given a better error message :P

Looking into my C:\WINDOWS\TEMP folder revealed:

And further looking at MSDN reveals:

The GetTempFileName method will raise an IOException if it is used to create more than 65535 files without deleting previous temporary files.

The GetTempFileName method will raise an IOException if no unique temporary file name is available. To resolve this error, delete all unneeded temporary files.

A bit of housekeeping, and voila

All good again :-)


Anonymous said...

Probably the same file naming convention from Windows 3.1.

Unknown said...

Hey Mark, check out the "Update Installation Wizard" tool. It suits better for installing the update packages and also has more options and troubleshooting abilities:

Anonymous said...

you are the best of the world !!! it works !! i am on this problem for14 hours, and now it works !! thank yooooouuuuu !!