Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start building solution without VS #4661

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ if (Test-Path $DotNetGlobalFile) {
}

# If dotnet is installed locally, and expected version is not set or installation matches the expected version
if ((Get-Command "dotnet" -ErrorAction SilentlyContinue) -ne $null -and `
if ($null -ne (Get-Command "dotnet" -ErrorAction SilentlyContinue) -and `
(!(Test-Path variable:DotNetVersion) -or $(& dotnet --version) -eq $DotNetVersion)) {
$env:DOTNET_EXE = (Get-Command "dotnet").Path
}
Expand All @@ -53,7 +53,7 @@ else {

# Download install script
$DotNetInstallFile = "$TempDirectory\dotnet-install.ps1"
md -force $TempDirectory > $null
mkdir -force $TempDirectory > $null
(New-Object System.Net.WebClient).DownloadFile($DotNetInstallUrl, $DotNetInstallFile)

# Install by channel or version
Expand Down
18 changes: 3 additions & 15 deletions nukebuild/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,9 @@ partial class Build : NukeBuild

static Lazy<string> MsBuildExe = new Lazy<string>(() =>
{
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
return null;

var msBuildDirectory = VSWhere("-latest -nologo -property installationPath -format value -prerelease").FirstOrDefault().Text;

if (!string.IsNullOrWhiteSpace(msBuildDirectory))
{
string msBuildExe = Path.Combine(msBuildDirectory, @"MSBuild\Current\Bin\MSBuild.exe");
if (!System.IO.File.Exists(msBuildExe))
msBuildExe = Path.Combine(msBuildDirectory, @"MSBuild\15.0\Bin\MSBuild.exe");

return msBuildExe;
}

return null;
return RuntimeInformation.IsOSPlatform(OSPlatform.Windows)
? RootDirectory / ".tmp" / "dotnet-win" / "sdk" / "3.1.401" / "MSBuild.dll"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good to think about not hard-coding the version

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you should be able to read global.json file here to find dotnet sdk version.

: null;
}, false);

BuildParameters Parameters { get; set; }
Expand Down
2 changes: 1 addition & 1 deletion nukebuild/BuildParameters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public class BuildParameters
public AbsolutePath ZipTargetControlCatalogDesktopDir { get; }


public BuildParameters(Build b)
public BuildParameters(Build b)
{
// ARGUMENTS
Configuration = b.Configuration ?? "Release";
Expand Down