codesign says my bundle format is ambiguous

After signing my app with codesign I use to do a ‘codesign -vvv myapp’ to check it. This is what I get:

myapp.app: bundle format is ambiguous (could be app or framework)
In subcomponent: Builds - myapp.xojo_binary_project/Mac OS X (Cocoa Intel)/myapp.app/Contents/Frameworks/XojoFramework.framework

This is what Apple says about that (https://developer.apple.com/library/mac/technotes/tn2206/_index.html#//apple_ref/doc/uid/DTS40007919-CH1-TNTAG313)

codesign says my bundle format is ambiguous.
codesign thinks your bundle looks a bit like an app and a bit like a framework.
Perhaps you have both Contents and Versions directories, or files in the top directory that match reserved names for directories in a bundle.
Perhaps there’s an Info.plist in an odd place.
In short, put everything in the correct places.

Is there any way to get rid of that error?

What does spctl -a -v /your.app say?

Did you by any chance move your App to another machine via Dropbox and try to codesign it there?

spctl -a -v /my.app says rejected

spctl -a -vvvv -t exec /myapp.app says
myapp.app : rejected
origin=Mac Developer: Bjorn Eiriksson (F9JXJ58237)

Huh?

I finally installed 10.11.5 (from 10.11.4), Xojo 2016r1.1 (from 2015r4.1), updated all the plugins I use to last versions and the problem is gone…

In the future; you can check to see if it’s an error with your code signing script by downloading the demo of App Wrapper and code signing there. If it works in App Wrapper, then you know it’s an issue with your script. If it doesn’t work in App Wrapper, then it’s most likely an issue with the signing process.

I found the problem, Dropbox. Pausing Dropbox while building the application is the solution. The target folder is in Dropbox and it looks like the Xojo Building and Dropbox syncing processes are not good friends.

They’re not. Dropbox locks things when it syncs.

It is definitely not a good idea to work in a cloud drive, such as DropBox or Google Drive. It can also impair project save.

Better work local and copy to the cloud drive when finished.

DropBox is frequently the cause of “Hey this weird thing happened with my project”