Skip to content

Commit 50bda06

Browse files
jonathanpeppersjonpryor
authored andcommitted
[xabuild.exe] fixes for paths/settings on macOS (#1685)
When looking at my Mono 5.12 installation, I noticed a few files we should be using with `xabuild.exe`: * `/Library/Frameworks/Mono.framework/Versions/5.12.0/lib/mono/msbuild/15.0/bin/NuGet.targets` * `/Library/Frameworks/Mono.framework/Versions/5.12.0/lib/mono/msbuild/15.0/bin/Sdks` directory `NuGet.targets` is needed for `XABuildPaths.NuGetRestoreTargets`, and the `Sdks` directory can be used for `MSBuildSdksPath`. Both of these values can still fall back to .NET Core, if they are not found. After these changes, macOS more closely matches the Windows code. We should be able to build a wider range of .NET standard projects with `xabuild.exe` now.
1 parent 8fd6696 commit 50bda06

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

tools/xabuild/XABuildPaths.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -143,18 +143,19 @@ public XABuildPaths ()
143143
MSBuildPath = Path.Combine (mono, "msbuild");
144144
MSBuildBin = Path.Combine (MSBuildPath, vsVersion, "bin");
145145
MSBuildConfig = Path.Combine (MSBuildBin, "MSBuild.dll.config");
146-
DotNetSdkPath =
147-
MSBuildSdksPath = FindLatestDotNetSdk ("/usr/local/share/dotnet/sdk");
146+
DotNetSdkPath = FindLatestDotNetSdk ("/usr/local/share/dotnet/sdk");
147+
MSBuildSdksPath = DotNetSdkPath ?? Path.Combine (MSBuildBin, "Sdks");
148148
ProjectImportSearchPaths = new [] { MSBuildPath, Path.Combine (mono, "xbuild"), Path.Combine (monoExternal, "xbuild") };
149149
SystemProfiles = Path.Combine (mono, "xbuild-frameworks");
150150
SearchPathsOS = IsMacOS ? "osx" : "unix";
151151

152-
string nuget = Path.Combine(mono, "xbuild", "Microsoft", "NuGet");
153-
if (Directory.Exists(nuget)) {
152+
string nuget = Path.Combine (mono, "xbuild", "Microsoft", "NuGet");
153+
if (Directory.Exists (nuget)) {
154154
NuGetTargets = Path.Combine (nuget, "Microsoft.NuGet.targets");
155155
NuGetProps = Path.Combine (nuget, "Microsoft.NuGet.props");
156156
}
157-
if (!string.IsNullOrEmpty (DotNetSdkPath)) {
157+
NuGetRestoreTargets = Path.Combine (MSBuildBin, "NuGet.targets");
158+
if (!File.Exists (NuGetRestoreTargets) && !string.IsNullOrEmpty (DotNetSdkPath)) {
158159
NuGetRestoreTargets = Path.Combine (DotNetSdkPath, "..", "NuGet.targets");
159160
}
160161
}

0 commit comments

Comments
 (0)