问题
Anybody seen the following an know of a workaround?
Question
If I have multiple solutions with multiple projects in each one. What I’m seeing is a failure to resolve assembly references. This seems to occur when I previously had an open solution that was built but had a missing reference (I forgot to build it). Then I open up the solution that will build the missing reference and do a build. Sometimes this solution fails to build even thought it has built successfully in the past.
Error Message
What I see is the following:
Target ResolveAssemblyReferences:
/Library/Frameworks/Mono.framework/Versions/3.2.6/lib/mono/4.0/Microsoft.Common.targets: warning : Reference ‘xxxx, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL' not resolved
For searchpath {CandidateAssemblyFiles}
Warning: {CandidateAssemblyFiles} not supported currently
For searchpath {HintPathFromItem}
For searchpath {TargetFrameworkDirectory}
Considered target framework dir /Library/Frameworks/Mono.framework/Versions/3.2.6/lib/mono/4.5, assembly named ‘xxxx' not found.
Considered target framework dir /Library/Frameworks/Mono.framework/Versions/3.2.6/lib/mono/4.5/Facades/, assembly named ‘xxxx' not found.
For searchpath {PkgConfig}
Considered xxxx, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL, but could not find in any pkg-config files.
For searchpath {GAC}
Considered xxxx, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL, but could not find in the GAC.
For searchpath {RawFileName}
For searchpath ../../../bin/ <— This is where the xxxx.dll is but it doesn’t find it
Now if I “Quit Xamarin” and reopen the solution in a new xamarin window and do a build the above error goes away for that assembly but if it has additional projects that depend on it they will fail. For example if I have a solution that has three projects with the following dependencies:
zzzz.dll depends on yyyy.dll depends on xxxx.dll
What I see is the build of the yyyy.dll will fail with the above error saying it can’t find the xxxx.dll.
Quiting and reopening a new version of Xamarin with the same solution and simply doing a build of the solution both xxxx.dll and yyyy.dll will build but the the zzzz.dll will fail saying it can’t find the yyyy.dll.
Now quiting and reopening a new version of Xamarin with the same solution and simply doing a build of the solution all three projects will build successfully.
Now if I quit and reopen Xamarin with the original solution that had the missing reference then it will find the assembly. However if it has multiple projects that depend on each other(no circular dependencies) then I have to go through the quit and reopen sequence for as many times as there are projects (minus one since the first one always seems to build).
来源:https://stackoverflow.com/questions/22561198/xamarin-not-resolving-references-correctly