diff --git a/tools/xabuild/SymbolicLink.cs b/tools/xabuild/SymbolicLink.cs index ed80fd1f8..c5b4d6b1e 100644 --- a/tools/xabuild/SymbolicLink.cs +++ b/tools/xabuild/SymbolicLink.cs @@ -16,15 +16,21 @@ namespace Xamarin.Android.Build if (!CreateSymbolicLink (source, target, SymbolLinkFlag.Directory | SymbolLinkFlag.AllowUnprivilegedCreate) && !CreateSymbolicLink (source, target, SymbolLinkFlag.Directory)) { var error = new Win32Exception ().Message; - Console.Error.WriteLine ($"Unable to create symbolic link from `{source}` to `{target}`: {error}"); - return false; + var result = Directory.Exists (source); + if (!result) + Console.Error.WriteLine ($"Unable to create symbolic link from `{source}` to `{target}`: {error}"); + return result; } } else { try { + var sourceInfo = new UnixFileInfo (source); var fileInfo = new UnixFileInfo (target); fileInfo.CreateSymbolicLink (source); - } catch (Exception exc) { - Console.Error.WriteLine ($"Unable to create symbolic link from `{source}` to `{target}`: {exc.Message}"); + } catch (UnixIOException exc) { + if (exc.ErrorCode == Mono.Unix.Native.Errno.EEXIST) { + return true; + } + Console.Error.WriteLine ($"Unable to create symbolic link from `{source}` to `{target}`: {exc}"); return false; } } diff --git a/tools/xabuild/XABuildPaths.cs b/tools/xabuild/XABuildPaths.cs index 98e06c49b..6949d13f4 100644 --- a/tools/xabuild/XABuildPaths.cs +++ b/tools/xabuild/XABuildPaths.cs @@ -114,10 +114,11 @@ namespace Xamarin.Android.Build SearchPathsOS = "windows"; } else { string mono = IsMacOS ? "/Library/Frameworks/Mono.framework/Versions/Current/lib/mono" : "/usr/lib/mono"; + string monoExternal = IsMacOS ? "/Library/Frameworks/Mono.framework/External/" : "/usr/lib/mono"; MSBuildPath = Path.Combine (mono, "msbuild"); MSBuildBin = Path.Combine (MSBuildPath, "15.0", "bin"); MSBuildConfig = Path.Combine (MSBuildBin, "MSBuild.dll.config"); - ProjectImportSearchPaths = new [] { MSBuildPath, Path.Combine (mono, "xbuild") }; + ProjectImportSearchPaths = new [] { MSBuildPath, Path.Combine (mono, "xbuild"), Path.Combine (monoExternal, "xbuild") }; SystemProfiles = Path.Combine (mono, "xbuild-frameworks"); XABuildConfig = Path.Combine (XABuildDirectory, "MSBuild.dll.config"); SearchPathsOS = IsMacOS ? "osx" : "unix";