Bug 25515 - ibtool is not invoked for nibs
Summary: ibtool is not invoked for nibs
Alias: None
Product: iOS
Classification: Xamarin
Component: MSBuild ()
Version: XI 8.6.0
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: 8.6.x (services rel)
Assignee: Jeffrey Stedfast
Depends on:
Reported: 2014-12-18 17:48 UTC by Randall Schmidt
Modified: 2015-01-20 13:16 UTC (History)
5 users (show)

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

Project files and build output (200.83 KB, application/octet-stream)
2014-12-18 17:49 UTC, Randall Schmidt
Reproduction case (27.21 KB, application/zip)
2015-01-02 17:34 UTC, Randall Schmidt
Reproduction case (34.44 KB, application/zip)
2015-01-02 18:23 UTC, Randall Schmidt
Reproduction case (read comments) (6.86 KB, application/zip)
2015-01-05 15:14 UTC, Randall Schmidt

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Comment 1 Randall Schmidt 2014-12-18 17:49:32 UTC
Created attachment 9135 [details]
Project files and build output
Comment 4 Randall Schmidt 2015-01-02 17:34:35 UTC
Created attachment 9232 [details]
Reproduction case

For a successful build, run:

/Applications/Xamarin\ Studio.app/Contents/MacOS/mdtool -v -v -v -v build "--configuration:Release|AnyCPU" ./succeed/objects/codegen/TestProj/*.sln

For a failing build run:

/Applications/Xamarin\ Studio.app/Contents/MacOS/mdtool -v -v -v -v build "--configuration:Release|AnyCPU" ./fail/objects/codegen/TestProj/*.sln

The only difference is that the nib is in a different place (and the csproj files respectively reference that place)
Comment 5 Randall Schmidt 2015-01-02 18:23:24 UTC
Created attachment 9233 [details]
Reproduction case

Sorry for spamming this report so much. I think this is the crux of it: referring to nibs by absolute path in the csproj file causes this failure.

Attachment README

You must edit the ./fail/objects/codegen/TestProj/TestProj.csproj file. Replace the absolute path to the nib file with the correct absolute path on your machine. The problem seems to be caused by absolute paths.


For a successful build, run:

/Applications/Xamarin\ Studio.app/Contents/MacOS/mdtool -v -v -v -v build "--configuration:Release|AnyCPU" ./succeed/objects/codegen/TestProj/*.sln

For a failing build run:

/Applications/Xamarin\ Studio.app/Contents/MacOS/mdtool -v -v -v -v build "--configuration:Release|AnyCPU" ./fail/objects/codegen/TestProj/*.sln

The only difference is that the nib is referred to by absolute path in the fail project.
Comment 6 Jeffrey Stedfast 2015-01-05 10:23:51 UTC
This sounds like something that has already been fixed in 8.6.0. The 8.4.0 stuff was still a work-in-progress preview.
Comment 7 Randall Schmidt 2015-01-05 10:28:20 UTC
This occurs in 8.6 too I'll update the version.
Comment 8 Jeffrey Stedfast 2015-01-05 12:12:31 UTC
bummer, but thanks for checking this
Comment 9 Jeffrey Stedfast 2015-01-05 13:56:39 UTC
This works with the latest 8.6.x for me. Perhaps the version of 8.6.0 that you tested is older than the fix.
Comment 10 Randall Schmidt 2015-01-05 15:14:08 UTC
Created attachment 9246 [details]
Reproduction case (read comments)

Thanks Jeffrey, going to Stable and then back to Alpha seems to have resolved the issue in that attachment... I apologize for that.

However, I have a second test case as well that is still exhibiting similar behavior even after uninstall and reinstalling everything twice. I have attached that. Please give it a look too.

I'm in the Alpha channel with:
Xamarin Studio 5.7.0
XCode 6.1.1
OS X 10.9.5

And the attached code behaves as follows:

From the root directory of the attachment:
/Applications/Xamarin\ Studio.app/Contents/MacOS/mdtool -v -v -v -v build --configuration:Debug ./objects/codegen/nisfpcontrols/controls/controls.sln

That works. Now run:
/Applications/Xamarin\ Studio.app/Contents/MacOS/mdtool -v -v -v -v build --configuration:Release ./objects/codegen/nisfpcontrols/controls/controls.sln

that fails. The behaviour in Xamarin Studio is the same.

I made this solution using the wizards in Xamarin Studio and no weird monkey business. I made a unified "iOS Library Project" in <some_directory>/objects/codegen/nisfpcontrols. Then I made an "Empty iPad Interface Definition" with the wizard at <some_directory>/source/controls/ios, with "Add to project" checked off and the project I just made selected. After doing this, the release build of the solution fails to build with the error:

"/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/4.5/Microsoft.Common.targets: Error: Cannot copy /Users/randall/Projects/25515Reproduction2/objects/codegen/nisfpcontrols/controls/controls/obj/Release/ibtool/TestNib.nib to /Users/randall/Projects/25515Reproduction2/objects/codegen/nisfpcontrols/controls/controls/obj/Release/controls.obj.Release.ibtool.TestNib.nib, as the source file doesn't exist. (controls)"

Following the solution creation steps above several times with both 8.4 and 8.6 I have seen no exception to this behavior.

By building and cleaning both the Debug and Release targets multiple times (and doing nothing else) in Xamarin Studio I am able to get it into a state where the Debug build won't build either. Cleaning does not remedy that.

If I use the default path that the wizard suggests for the nib, I don't have this issue.

Please confirm what versions of everything you are using. Thanks for the help.
Comment 11 Jeffrey Stedfast 2015-01-05 15:55:37 UTC
The problem is that your debug and release intermediate files are ending up in the same place.

I added some debug "printf's" to see what was happening when compiling in Release as I could see that it wasn't compiling the xib file:

	Target _CoreCompileInterfaceDefinitions:
	Task "IBToolTask"
		Using task IBToolTask from Xamarin.MacDev.Tasks.IBToolTask, Xamarin.MacDev.Tasks, Version=1.0.5483.28447, Culture=neutral, PublicKeyToken=null
		IBTool Task
		  IntermediateOutputPath: obj/Release/
		  Platform: AnyCPU
		  ResourcePrefix: Resources
		  SdkBinPath: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk/Developer/usr/bin
		  SdkRoot: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk
		  SdkVersion: 8.1
		Does obj/Release/ibtool/../../../../../source/controls/ios/testnib.plist exist? True
		mtime for obj/Release/ibtool/../../../../../source/controls/ios/testnib.plist: 1/5/2015 3:38:50 PM
		mtime for ../../../../../source/controls/ios/testnib.xib: 1/5/2015 3:06:56 PM
	Done executing task "IBToolTask"
	Done building target "_CoreCompileInterfaceDefinitions" in project "/Users/fejj/Downloads/TestProj/objects/codegen/nisfpcontrols/controls/controls/controls.csproj".

The testnib.plist file is the output generated by ibtool so that the MSBuild tasks can go back and read the errors/warnings/etc from ibtool. It's also used for comparing timestamps to decide if the input file has changed.

TL;DR: don't use the same output directories for debug and release builds.
Comment 12 Randall Schmidt 2015-01-05 16:07:47 UTC
In the controls.csproj in the attachment there are different paths for the debug and release builds:

<OutputPath>bin\Debug</OutputPath> for debug
<OutputPath>bin\Release</OutputPath> for release

Moreover, given that I created this solution with Xamarin Studio with the steps listed above, should not Xamarin Studio have generated a viable solution?
Comment 13 Jeffrey Stedfast 2015-01-05 16:20:01 UTC
Right, but the problem is the relative path of the nib file exists outside of the project directory, so it uses the ../../../../../../../ which destroys the encapsulation of the output.

The real paths of the output files for both configurations is the same despite using "bin\Debug" and "bin\Release" because of all of the ../'s
Comment 14 Randall Schmidt 2015-01-05 16:24:42 UTC
That sounds like a bug to me, no?

This did work before MSBuild, it's a regression for this use case.
Comment 15 Jeffrey Stedfast 2015-01-05 16:34:00 UTC
do you have a suggestion on how to generate the output paths in such a way that would not suffer from this problem with your use case or anyone else's?

The old way worked because it always compiled xibs, even when it didn't need to. There were numerous bug reports about that causing builds to be slow.
Comment 16 Randall Schmidt 2015-01-05 16:43:04 UTC
I don't understand that problem fully. I only understand the problem facing me and anyone else who wants to have source files outside of the project directory. That problem seems to be two-fold:

1. Xamarin can't support it (I'm not saying I believe it but that seems to be what you're hinting at)
2. Xamarin doesn't bother to tell you that it can't support it.

I am confident that #2 could be fixed if #1 cannot.
Comment 17 Jeffrey Stedfast 2015-01-05 16:48:14 UTC
The only way I can think of to solve this is to not combine the intermediate output path with the project relative path, and instead use perhaps the bundle relative path instead.

Git master does that now so this is solved.
Comment 18 Randall Schmidt 2015-01-05 16:52:35 UTC
Great, then that means it will be in the 8.6 stable release?
Comment 19 Jeffrey Stedfast 2015-01-05 16:57:51 UTC
git master is 8.10. I've asked if it can go into 8.6 but it might be too late for 8.6
Comment 20 Randall Schmidt 2015-01-05 17:05:11 UTC
Thank you, if it is too late at least I know how to work around it now. It just won't be pretty.
Comment 21 Jeffrey Stedfast 2015-01-06 13:40:38 UTC
This wasn't accepted for 8.6.0, but it's likely to go into an 8.6.x update.
Comment 22 Randall Schmidt 2015-01-06 13:56:20 UTC
Got it, thanks for the update
Comment 23 Rolf Bjarne Kvinge [MSFT] 2015-01-07 11:37:09 UTC
Marking as candidate for a 8.6 service release.
Comment 24 Jeffrey Stedfast 2015-01-16 11:40:15 UTC
*** Bug 25800 has been marked as a duplicate of this bug. ***
Comment 25 Ram Chandra 2015-01-20 13:16:26 UTC
I have checked this issue with following builds:

Mac OS X 10.10.0
Xamarin Studio: 5.7 (build 661)
Installation UUID: 6ea47b0d-1852-4aaf-808d-373ff0a5002b
Mono 3.12.0 ((detached/a813491)
GTK+ 2.24.23 (Raleigh theme)
Package version: 312000068
Xcode 6.1 (6604)
Build 6A1052d
Xamarin.iOS: (Enterprise Edition)
Hash: 17a8694
Build date: 2015-01-20 10:41:08-0500
Xamarin.Mac: (Enterprise Edition)
=== Build Information ===
Release ID: 507000661
Git revision: b70bab61da996da29045ea8ee8aed1a6faedbe78
Build date: 2015-01-05 16:31:31-05
Xamarin addins: 82f6c71490562d6cd125a09287f441902fdac3d7

Observation:  To verify this issue I have run both the command mentioned in "Comment 5" and in "Comment10" with the attached projects and I am able to successfully build both the attached project.

This issue has been fixed. Hence, I am closing this issue.