Bug 33932 - Project builds on MAC but not PC give 'defined in an assembly that is not referenced. You must add a reference to assembly'
Summary: Project builds on MAC but not PC give 'defined in an assembly that is not ref...
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Android Add-in ()
Version: 5.9
Hardware: PC Windows
: Normal normal
Target Milestone: master
Assignee: Greg Munn
Depends on:
Reported: 2015-09-14 10:57 UTC by Paul Read
Modified: 2015-09-22 16:46 UTC (History)
1 user (show)

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

Showing the issue as presented to me (113.21 KB, image/png)
2015-09-18 04:27 UTC, Paul Read
Android Tools log (1.89 KB, application/octet-stream)
2015-09-18 04:50 UTC, Paul Read
IDE log (10.09 KB, application/octet-stream)
2015-09-18 04:51 UTC, Paul Read
Components log (349 bytes, application/octet-stream)
2015-09-18 04:51 UTC, Paul Read
Build log with full diagnostics (814.12 KB, application/octet-stream)
2015-09-18 05:55 UTC, Paul Read
output from msbuild /v:diag (42.63 KB, text/plain)
2015-09-22 05:07 UTC, Paul Read
The bad android project (14.69 KB, application/octet-stream)
2015-09-22 15:12 UTC, Paul Read
A (maybe) good version (13.69 KB, application/octet-stream)
2015-09-22 15:12 UTC, Paul Read

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:

Description Paul Read 2015-09-14 10:57:06 UTC
Description of Problem:
Can build Android project on a MAC but the same project does not build on 2 different PCs using XS.  Have reinstalled XS on one machine and still issues exists, please help.

Full error:

C:\dev_xam\MyTAS\app\Droid\Services\GCM.cs(17,17): Error CS0012: The type 'System.Threading.Tasks.Task' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Threading.Tasks, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. (CS0012) (MyTAS.Droid)

Please note the project used to build OK on a pc about 8 weeks ago and after building ok on Mac I brought it back to PC and it no longer builds (various XS updates in the meantime)

I tried to recreate the project from scratch on PC but still have the issue
Comment 1 Greg Munn 2015-09-16 09:43:53 UTC
Can you attach a sample project that recreates this issue, or the project itself? Also, could you attach the full, diagnostic, build output and IDE logs (Help | Open log directory) please.
Comment 2 Paul Read 2015-09-18 04:27:37 UTC
Created attachment 12935 [details]
Showing the issue as presented to me

Notice the red crosses - are they normal?
Comment 3 Paul Read 2015-09-18 04:50:44 UTC
Created attachment 12936 [details]
Android Tools log

Android Tools log
Comment 4 Paul Read 2015-09-18 04:51:01 UTC
Created attachment 12937 [details]
IDE log

IDE log
Comment 5 Paul Read 2015-09-18 04:51:14 UTC
Created attachment 12938 [details]
Components log
Comment 6 Paul Read 2015-09-18 04:51:28 UTC
various logs attached
Comment 7 Paul Read 2015-09-18 05:55:53 UTC
Created attachment 12940 [details]
Build log with full diagnostics
Comment 8 Greg Munn 2015-09-21 15:21:05 UTC

One of the Xamarin Android team members looked over the log but wasn't able to tell immediately what was wrong. Are you able to repro the same failure by building from the cmdline?

{projectdir}\msbuild /v:diag

can you capture that output as well and attach it?

(No, the red crosses are not normal, something is not right).
Comment 9 Paul Read 2015-09-21 16:15:24 UTC
All I got was:

C:\dev_xam\MyTAS\app\Droid>msbuild /v:diag
'msbuild' is not recognized as an internal or external command,
operable program or batch file.
Comment 10 Greg Munn 2015-09-21 16:20:04 UTC
Start one of the VS command prompt sessions that includes msbuild in the path, or specify the full path - (pretty sure it's something like C:\Program Files (x86)\MSBuild\12.0\bin\msbuild.exe" but the exact path will depend on what version you have installed.
Comment 11 Paul Read 2015-09-22 04:51:27 UTC
Could that be the issue? I don't have VS installed. Just trying to find msbuild.exe
Comment 12 Paul Read 2015-09-22 05:07:09 UTC
Created attachment 13009 [details]
output from msbuild /v:diag

Not sure it will help given: 
error XA9008: Building from the command-line requires aÿBusinessÿLicense.
Comment 13 Greg Munn 2015-09-22 10:09:29 UTC
Paul, is there any chance you could attach your project to this bug - mark it private - so that I can get one the Android team members to try an reproduce the issue. There appear to be a number of other similar bugs, including one you commented on (bug #27469) recently.
Comment 14 Paul Read 2015-09-22 15:12:26 UTC
Created attachment 13026 [details]
The bad android project
Comment 15 Paul Read 2015-09-22 15:12:57 UTC
Created attachment 13027 [details]
A (maybe) good version
Comment 16 Paul Read 2015-09-22 15:18:06 UTC
My doing a diff with a working project I remove some stuff from the failing Android project file e.g

    <Reference Include="System.Threading" />

and it now builds  again :-)

I'm not 100% sure it is fixed as my Xamarin PLayer failed a while ago so does not run and deploying to device fails with the incompatible version but those are different issues.

Maybe you can add the bad lines back into a working project of yours and see if it causes it to fail again to really eliminate the project.

I'm reluctant to attach my full project as it is commercial (though if Xamarin offered a 'code review' service I'd definitely would!)
Comment 17 Greg Munn 2015-09-22 15:50:42 UTC
I can't recreate the issue simply by adding the reference to system.threading. You shouldn't need that in your android project.

However, I did manage to recreate all the references with the red crosses in them (including system.threading) by adding Automapper to a project.

I try would removing all those invalid references and see what happens.
Comment 18 Paul Read 2015-09-22 16:05:44 UTC
On my PC XS removing and adding Automapper does not recreate the red crosses.  I need to try the same on a MAC and then bring the resultant project to my PC to replicate what I did previously.

I think with the invalid references simply removed by hand it builds ok. Ta
Comment 19 Greg Munn 2015-09-22 16:46:20 UTC
Ok, glad you got it building.