Bug 59697 - iOS Library projects fail CompileEntitlements when Analysis is enabled
Summary: iOS Library projects fail CompileEntitlements when Analysis is enabled
Alias: None
Product: iOS
Classification: Xamarin
Component: MSBuild (show other bugs)
Version: XI 11.0 (xcode9)
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: Future Cycle (TBD)
Assignee: Vincent Dondain [MSFT]
Depends on:
Reported: 2017-09-22 14:28 UTC by Tomasz Cielecki
Modified: 2017-12-05 21:44 UTC (History)
6 users (show)

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


Description Tomasz Cielecki 2017-09-22 14:28:14 UTC
We have added SonarQube to our build script, which does something with MSBuild that might be what is triggering some issues. Prior to enabling SonarQube everything seems to build fine.

What SonarQube seems to do is to enable analysis of the solution, which triggers that Xamarin.Analysis.targets come into the picture.

With SonarQube enabled our build fails on a iOS Class Library project, which does not have any Entitlements and only has the Platform configuration AnyCPU. Even so, the build fails with the "CompileEntitlements" task failing due to a whole bunch for properties not being set. I have attached the build log, which includes the Diagnostics output from MSBuild to this report.

It appears to me that the CompileEntitlements task is run, because somewhere during the build it changes the Platform from AnyCPU to iPhone, which then triggers it. I believe this shouldn't happen, because no native code is created here and no entitlements need to be compiled.
Comment 3 Vincent Dondain [MSFT] 2017-10-06 20:17:42 UTC
I could confirm this issue, it seems indeed to come from the fact that SonarQube does a `RunCodeAnalysis` which triggers Xamarin.Analysis which seem to have an issue with iOS libraries.

An easy way to reproduce this is to create a brand new Xamarin.iOS library (New Project > iOS > Library > Class library) and do Project > Run Code Analysis on Solution (menu bar).

We then get: `/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets(1381,3): error MSB4044: The "CompileEntitlements" task was not given a value for the required parameter "AppBundleDir".`

Full build output: https://gist.github.com/VincentDondain/d1072c74c6a38cb8f88c2e5d6d445aa4

Version information: https://gist.github.com/VincentDondain/53390dbaca03c15a2e50a28a2da86e5c
Comment 4 Jeffrey Stedfast 2017-10-09 18:56:55 UTC
Want me to handle this one? I think I have an idea for a fix (I just noticed you assigned this to yourself a few seconds ago)
Comment 5 Vincent Dondain [MSFT] 2017-12-05 17:52:51 UTC
Pending PR: https://github.com/xamarin/xamarin-macios/pull/3084

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