Bug 15466 - Build error: Cannot import Xamarin.Mac.targets
Summary: Build error: Cannot import Xamarin.Mac.targets
Status: RESOLVED INVALID
Alias: None
Product: Xamarin.Mac
Classification: Desktop
Component: Other ()
Version: 1.6.19
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Aaron Bockover [MSFT]
URL:
Depends on:
Blocks:
 
Reported: 2013-10-17 14:37 UTC by David Aramant
Modified: 2013-10-17 16:34 UTC (History)
1 user (show)

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


Attachments
Stripped-down solution showing build error (13.73 KB, application/zip)
2013-10-17 14:37 UTC, David Aramant
Details


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:
Status:
RESOLVED INVALID

Description David Aramant 2013-10-17 14:37:52 UTC
Created attachment 5164 [details]
Stripped-down solution showing build error

One of our solutions stopped building at some point.  It contains a Xamarin.Mac project, a test project, and a .NET resource project.  Attempting to build the solution results in the following error (paths shortened):

Source/Installer.Tests/Installer.Tests.csproj: Error: Source/Installer/Installer.csproj: Source/Installer/Installer.csproj could not import "$(MSBuildExtensionsPath)\Xamarin\Mac\v0.0\Xamarin.Mac.targets" (Installer.Tests)

We don't build this solution very often so I'm not sure what update caused it to stop working.  I can say that when I tried uninstalling Xamarin Studio (dragging to Trash) and Mono (using uninstall_mono.sh) and reinstalling it from a fresh download, it did build successfully until I installed the available updates.  The downloaded version of Mono was 3.2.0, don't remember about X.Studio.  I have included the current versions at the end of the description.

I managed to strip down our solution to have virtually nothing in it and still retain the error.  The Xamarin.Mac project and the .NET resource project can be built, but the test project fails.

=== Xamarin Studio ===

Version 4.0.13 (build 38)
Installation UUID: 1fcc71a0-766d-4a62-b611-8edd0fdc5d1e
Runtime:
	Mono 3.2.3 ((no/8d3b4b7)
	GTK+ 2.24.20 theme: Raleigh
	GTK# (2.12.0.0)
	Package version: 302030000

=== Apple Developer Tools ===

Xcode 5.0 (3332.25)
Build 5A1413

=== Xamarin.Mac ===

Xamarin.Mac: 1.6.19

=== Build Information ===

Release ID: 400130038
Git revision: 07afec667f7be5d0ee511eb7115bbac6377fbae8
Build date: 2013-09-24 08:53:29+0000
Xamarin addins: 61140345a5b109633a94409edcbc7a4c19a425c6

=== Operating System ===

Mac OS X 10.8.5
Darwin davids-mac-mini.net.sep.com 12.5.0 Darwin Kernel Version 12.5.0
    Sun Sep 29 13:33:47 PDT 2013
    root:xnu-2050.48.12~1/RELEASE_X86_64 x86_64
Comment 1 Aaron Bockover [MSFT] 2013-10-17 15:58:49 UTC
Xamarin.Mac does not support building with xbuild/MSBuild. Turn off xbuild/MSBuild for the Xamarin.Mac project (see Project Options).

I'm assuming Installer.Tests.csproj is *not* a Xamarin.Mac project? If so, it should not have the following directive:

<Import Project="$(MSBuildExtensionsPath)\Xamarin\Mac\v0.0\Xamarin.Mac.targets" />

Remove that if it's there.
Comment 2 David Aramant 2013-10-17 16:20:47 UTC
Turning off xbuild for Installer.Tests fixed the build, but what's confusing to me is that it isn't the Xamarin.Mac project, nor does it have any references to Xamarin.Mac.targets.  In our other solution that still builds fine, all of our projects other than the Xamarin.Mac one have the xbuild option enabled (did this use to be the default for new projects?).
Comment 3 Aaron Bockover [MSFT] 2013-10-17 16:34:35 UTC
It's likely because it's a dependency of the project. Basically it appears that in XS 4.0.13 you have to disable xbuild for your Xamarin.Mac projects.