I think I found a solution, I just don't like it.
If you don't just add the app into the project of the EXE, but also all the PRGs and set them to excluded, you get no build error. If the app project is more complex this could easily become a maintenance problem, though it becomes obvious when you build the EXE and get compile errors again, that you forgot to add in some prg.
I am a bit reluctant here to accept that as a solution, as it should be sufficient for VFP to add the app. It should even be sufficient to have a DO of the APP in code, which makes the build process add the APP to the EXE project. That's fine, but nothing else from the app project should be necessary to be project item of the EXE project.
It makes me think on the inverse problem, that the build process finds things in excluded project items and accepts calls to code within them also if no app is also present that indeed has that function or prg. And indeed, that's the case. If you exclude a PRG but still use it in the EXE, running the EXE gives a runtime error "excluded.prg does not exist". So in the end I found a solution based on a bug to easily fool the build process about the existence of code. I'm even quite sure it's a "known bug".
This bug obviously has to be accepted as there will be no new VFP version, but it means a lot of caution to not accidentally exclude something and rely on that causing a build error, it does actually not do so. Using that bug as a solution seems like a bad idea, though.
I can imagine to write a project hook that you use in the app project which then has to know the companion EXE project and will simply add any item during the build process to the EXE process as excluded item. Then the build of the EXE causes no build errors. But that would not solve it for the situation I thought of, that an app becomes a mandatory library to be integrated into several EXE projects by different developers of a team, as they will need the full sources of the app just to include them as excluded in their EXE projects. That's crazy.
Chriss