Tuesday, March 1, 2011

Why would VS2005 be looking for a file it's supposed to be generating?

I'm working on a PocketPC app in Visual Studio 2005. The solution was building fine, then suddenly broke. The first error is this (assume the project is FooPDA):

"Unable to find source file 'C:\FooPDA\obj\Release\FooPDA.exe' for file 'FooPDA.exe', located in '%InstallDir%', the file may be absent or locked."

This error is rather confusing to me. It's looking for the file it's supposed to be generating. Anyone have any idea what might be going wrong here?


Edit: The project builds fine right out of version control, I simply change the icon on the project, and it starts throwing this mysterious error.

From stackoverflow
  • Sometimes this happens to me in class libraries, etc. If the solution does not build properly, it never gets to the point where it generates the .exe file.

    Can you compile without running the project, or do you get the same error when just trying to compile as well?

    If you can, I would try fixing any compilation errors and rebuilding.

  • Close Visual Studio. Clean your solution. Build your solution again.

    Does the message appear again?

    Sometime VS lock some file when compiling, it might be locked from a previous build.

    raven : That didn't work. Still getting the error message.
    Daok : I'll check it for you when I come back at home
  • "Unable to find source file 'C:\FooPDA\obj\Release\FooPDA.exe'

    It's trying the create file C:\FooPDA\ bin\Release\FooPDA.exe.

    C:\FooPDA\ obj\Release\FooPDA.exe is one file (ok, pretty much the only one) it use to create that (mostly by copying it).

    It sounds like for some other reason, the build failed (syntax error, etc), but somewhat the rest of the build process didn't get the word, and kept going.

  • Seeing %InstallDir% in the error message might be a lead. Do you have a Setup and Deployment project in your solution? Does it get build before your FooPDA project? Seeing it looking in obj is fishy too.


    OP Edit: You were on the right track, so I'll credit you with the answer. Turns out that when you do a rebuild, the Visual Studio 2005 compiler is pretty stupid in that it doesn't stop when it hits a project that it can't compile. It just keeps on compiling and throwing errors.

    This particular solution contains three projects. We'll call them FooPDA, PDAComponents and Setup. I changed the icon on project FooPDA and the solution would no longer compile. The error I was concentrating on had nothing to do with the actual problem. I should have concentrated on the error I saw when I did the initial build , which was:

    CVTRES: fatal error CVT1103: cannot read file

    I basically blew this off and immediately did a rebuild. That's when the error I posted came to the top of the error list and I was fixated upon it. I should not have been. The error I originally posted was due to the fact that FooPDA was not compiling, so FooPDA.exe was not available when it came time to compile the setup project. The reason FooPDA failed to compile when I changed the icon was due to the fact that the .ico file I was trying to add contained incompatible icon sizes and/or color depths. Apparently the compact framework (or the target platform, PocketPC 2003?) only understands certain of these. The .ico file that I was trying to add had all sorts of sizes and color depths embedded within it (all the way up to 256x256 @32 bit). I looked at the .ico file that was originally there and it had just two 48x48 icons. One 24 bit color and one 8 bit. I opened up my new .ico file in an icon editor and modified it to contain the same size and color depths as the original and all was right with the world again. The solution now compiles with the new icon, no problem.

    On the one hand, I feel kind of foolish for not figuring this out (I finally asked a coworker who had encountered this before). On the other hand, what the f**k does "CVTRES: fatal error CVT1103: cannot read file" tell me? Nothing! What's wrong with "Error: incompatible icon"?

  • Thank you, thank you. This error had been driving me crazy for weeks!

0 comments:

Post a Comment