Bug 18617 - Rebuilding Project with PCL causes Reference Exceptions
Summary: Rebuilding Project with PCL causes Reference Exceptions
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: General ()
Version: 1.10.x
Hardware: PC Mac OS
: Normal normal
Target Milestone: 4.0.0 (C6)
Assignee: Bugzilla
Depends on:
Reported: 2014-03-27 13:19 UTC by James
Modified: 2015-09-24 08:35 UTC (History)
10 users (show)

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

Pictures and Text build output from Visual Studio for first and second build (169.67 KB, application/zip)
2014-03-27 13:19 UTC, James

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 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 James 2014-03-27 13:19:03 UTC
Created attachment 6425 [details]
Pictures and Text build output from Visual Studio for first and second build

Customer Application has a number of 17 portable class libraries and one platform specific project. If they rebuild the solution, everything is fine, but they try to execute/debug hitting the F5 another build starts and this second build fails all the time. 

Workaround to debug- Remove the Debug and Obj subfolders and hit F5. Only doing so I can work with the android tool.

This behavior does not repeat in Xamarin Studio on Windows.

Customer steps to reproduce:
1. Start Visual Studio and load the solution

2. Hit F5 -> see the Attachment Build_1.txt -> the app starts on the device and I can debug, but there is an error as displayed in Build_1_Error.png.

3. Make a valid change in project

4. Hit F5 -> see the Attachment Build_2.txt -> the errors “The type or namespace name 'xxx' could not be found” refers to the project/library DialogModelSystem.PCL, the missing types are defined in this libraries: Types.PCL and ServiceTypes.PCL. This libraries are in the build order before the project DialogModelSystem.PCL, as you can see in SoviaClient_Android.csproj.txt. The references were made as project references.
Comment 1 Andrew 2014-04-01 15:43:14 UTC
I have exactly the same issue. First build goes ok, the next build (even within several seconds) fails with "error CS0246: The type or namespace name '*****' could not be found".

As far as I was able to understand the problem from MSBUILD logs, all solution project references are absent in csc.exe command line (/reference key), only system libraries (mscorlib.dll etc) are passed as parameters.

I'm not good in MSBUILD configuration to resolve it myself. 

This issue started appearing after recent Xamarin update. I faced with it when was using VS 2010, but when switched to VS 2013 (clean install on a clean PC) the problem remained.

I'm using VS 2013
Xamarin.Android   4.12.02001 (a1e3982a)
Xamarin.iOS   1.10.47 (3d6a125d)

James, to help Xamarin team to troubleshoot, please do the following:

1) go to your VS options, "Project and Solutions\Build and Run" and set max number of parallel builds to 1;
2) set MSBUILD project build and build log verbosity to "detailed"
3) reproduce the issue (use "Build" instead of "Run" to skip deployment logs to be written) and attach the build log to your bug report.

Comment 4 Enzo Heredia 2015-08-19 14:48:19 UTC
can't reproduce in