I have a uno which has the omniboot loader installed. If I use the Arduino IDE and program it, it loads fine and the verbose output says avrdude is loading MyFoo.ino.hex. If I use Xloader to load the same file, it works fine also. But if I use Xloader to load MyFoo.ino.with_bootloader.hex it loads OK, the program starts to run, then Xloader say "Upload Failed".

I got both the hex files from the Local Temp directory produced by Arduino.

I want to be able to update the original version of MyFoo using Xloader repeatedly as new versions of MyFoo come out. That is why I thought I needed to use the "with_bootloader" version of the hex file. But now I am thinking that it is trying to install the bootloader twice or something. MyFoo is pretty large, so putting it in twice might not fit.

I am really guessing at what is going on here. I hope someone can set me straight. Which hex file should I be using?

You probably mean “optiboot”?
If you’re doing your upload via the serial port, you do NOT need the “with_bootloader” version of the .hex file, and in fact since you are using the bootloader, you won’t be able to overwrite the bootloader, so It’s not surprising that you get errors.
(You may also get errors if Xloader “skip” empty pages that aren’t actually empty on the chip. Unlike an external programmer, the bootloader does not erase all of the “unused” pages.

Thanks this makes sense at last.