This is Xamarin's bug tracking system. For product support, please use the support links listed in your Xamarin Account.
Bug 49097 - [msbuild] codesign is always executed
Summary: [msbuild] codesign is always executed
Alias: None
Product: iOS
Classification: Xamarin
Component: MSBuild (show other bugs)
Version: master
Hardware: PC Mac OS
: Normal enhancement
Target Milestone: (C9)
Assignee: Jeffrey Stedfast
Depends on:
Reported: 2016-12-06 15:46 UTC by Rolf Bjarne Kvinge
Modified: 2016-12-27 06:24 UTC (History)
4 users (show)

See Also:
Is this bug a regression?: ---
Last known good build:


Description Rolf Bjarne Kvinge 2016-12-06 15:46:49 UTC

* Create test project.
* Build for device.
* Build for device again (without doing any changes).

codesign is executed in both builds.
Comment 1 Rolf Bjarne Kvinge 2016-12-06 15:48:46 UTC
Looks like the _CodesignAppBundle target doesn't have doesn't have any Inputs/Outputs (same with _CodesignNativeLibraries and _CodesignFrameworks).
Comment 2 Sebastien Pouliot 2016-12-08 19:51:41 UTC
Ouch, I suspect re-signing means re-uploading to the device :(

If that's the case then we might want to backport this to C9 as it would impact build/deploy times when debugging.
Comment 3 Jeffrey Stedfast 2016-12-14 21:33:23 UTC
The only solution I can think of is to have a stamp file for each resource that gets codesigned.
Comment 4 Vincent Dondain 2016-12-14 23:13:27 UTC
Okay so let me post all my discoveries at this point:

Both XS and Xcode seem to re-run codesign at every build the question is: does that actually force re-upload on our side? And the answer is: yes it does!

Basically we will re-upload if the app bundle has changed (we compare the last write timestamp against the last time we uploaded the app to the device).


With some logging of all the files that changed since last upload I found out that:

- (native executable)

are the files that change when we re-build (no clean) with no changes at all.

This is forcing re-upload.

The native executable change would be due to codesign (even though Xcode's native executable does not change after each build) and the other files are due to some other tasks.
Comment 5 Jeffrey Stedfast 2016-12-15 16:22:57 UTC
Thanks for looking into this, @Vincent! HUGE help :)

I think that the way that I'm going to do this is I'm going to submit 2 separate PR's.

The first PR will fix the archived-expanded-entitlements.xcent and embedded.mobileprovision outputs to not change while the second PR which will fix the Codesign task.

The reason for the split is that the Codesign changes will need different logic for cycle8/9 and for cycle10 (at least once my App Extension codesign-delay changes for cycle10 get merged).
Comment 6 Jeffrey Stedfast 2016-12-15 16:45:35 UTC
PR #1 (cycle10):

This should easily be portable to cycle9 (and even cycle8 if we want to), but it will depend on (since this patch removes a `using System.Linq;` statement - otherwise a little massaging can be done).
Comment 7 Jeffrey Stedfast 2016-12-16 18:37:54 UTC
PR #1 for cycle9:
Comment 8 Jeffrey Stedfast 2016-12-16 21:53:35 UTC
PR #2 for master:
PR #2 for cycle9:
Comment 9 Saurabh 2016-12-27 06:24:46 UTC
I can reproduce this Issue with stable XI and observed that (native executable),, getting change every time when rebuild app without any change.

I have chacked the same with latest Cycle 9 build (XI and Master build (XI and observed that now (native executable),, not getting change when rebuild app without any change.

Build Output:
Environment Info and Logs:

Note You need to log in before you can comment on or make changes to this bug.