Skip to content

Commit

Permalink
Add runtime to filename
Browse files Browse the repository at this point in the history
  • Loading branch information
CAPCHIK committed Jan 18, 2021
1 parent b920fef commit b33e6f2
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions build/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
using static Nuke.Common.IO.FileSystemTasks;
using static Nuke.Common.IO.PathConstruction;
using static Nuke.Common.Tools.DotNet.DotNetTasks;
using static Nuke.Common.Logger;

[CheckBuildProjectConfigurations]
[ShutdownDotNetAfterServerBuild]
Expand All @@ -24,7 +25,7 @@ class Build : NukeBuild
/// - Microsoft VisualStudio https://nuke.build/visualstudio
/// - Microsoft VSCode https://nuke.build/vscode

public static int Main () => Execute<Build>(x => x.Compile);
public static int Main () => Execute<Build>(x => x.Publish);

[Parameter("Configuration to build - Default is 'Debug' (local) or 'Release' (server)")]
readonly Configuration Configuration = IsLocalBuild ? Configuration.Debug : Configuration.Release;
Expand Down Expand Up @@ -65,8 +66,9 @@ class Build : NukeBuild
.DependsOn(Compile, Clean)
.Executes(() =>
{
var projectName = "Excursion360.Desktop";
DotNetPublish(s => s
.SetProject(Solution.GetProject("Excursion360.Desktop"))
.SetProject(Solution.GetProject(projectName))
.SetConfiguration(Configuration)
.SetOutput(OutputDirectory)
.SetRuntime(Runtime)
Expand All @@ -76,6 +78,21 @@ class Build : NukeBuild
.SetProperty("DebugType", "None")
.SetProperty("DebugSymbols", false)
.EnableNoRestore());

var exeFiles = System.IO.Directory.GetFiles(OutputDirectory);

foreach (var file in exeFiles)
{
Normal(file);
}

var executableFile = System.IO.Directory.GetFiles(OutputDirectory)
.Select(System.IO.Path.GetFileName)
.Where(f => f.StartsWith(projectName))
.Single();
RenameFile(OutputDirectory / executableFile,
$"{OutputDirectory / projectName}.{Runtime}{executableFile.Substring(projectName.Length)}");

});

}

0 comments on commit b33e6f2

Please # to comment.