iOS linking trouble

I have written an iOS App that is used in-house about a year ago.
Now my ad-hoc development and distribution profiles are about to expire so I tried to set up new ones.
That is when my nightmare started.
No matter what I do, Xojo won´t build an iOS App because something is wrong with my profiles.
I searched the web/forum for weeks and tried everything that I could find, unfortunately it is still not working.
I scrapped all my certificates and profiles from my developer account and set everything up fresh.
Yet I still get this error, when I try to build: http://bremac.de/1.png
I guess Xojo is trying to link with my old profile.
How can I tell Xojo which provisioning profile it should use for linking?

I recently went through updating an app and ran into a similar error. I found instructions in the help for creating a profile and followed those and it did work. However, the name in the project needs to match the name the profile was created under on the developer portal. Mine didn’t for some reason even though it worked previously. I changed the name in my project and that fixed the issue.

Also, I can’t remember why but I do recall having to move one profile file manually into the folder where the profiles are stored. I think for some reason XCode didn’t put it there and so I downloaded it from the developer portal and placed it there myself.

I did find the whole process tedious and not very friendly, but it wasn’t that difficult once I went through it a time or two. Right now if I were to have to do it again I’d have to search for the docs and basically start from scratch because it’s all a blur.

Firstly, can you tell us what version of Xojo you are using? And what version of Xcode?

I am using macOS 10.12.4, Xojo 2017 Release 1 and Xcode 8.3.2.

OK, finally I am a HUGE step forward.
I followed the instructions on http://developer.xojo.com/userguide/device-deployment again.
When I leave “Build For App Store” off, I can build my app and copy it to the iPhone :-)))

Last year it worked with “Build For App Store” on and gave me both an .app-file and an .ipa-file (That was with older versions of Xcode and Xojo of course).
I guess I don´t need the .ipa for ad-hoc deployment but I still would like to know the difference between those files.

The IPA file is a compressed file that contains the APP container and some SYMBOLS files.

To deploy an app on the AppStore, ApplicationLoader will only accept IPA files.
ApplicationLoader is a utility app included in Xcode that sends the file to Apple servers before deploying on the AppStore