BuildTools: Fix 64bit csproj
This commit is contained in:
@@ -1,4 +1,26 @@
|
||||
using System;
|
||||
/*
|
||||
* Process Hacker Toolchain -
|
||||
* Build script
|
||||
*
|
||||
* Copyright (C) dmex
|
||||
*
|
||||
* This file is part of Process Hacker.
|
||||
*
|
||||
* Process Hacker is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Process Hacker is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Process Hacker. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
|
||||
@@ -800,6 +800,24 @@ namespace CustomBuildTool
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool BuildSdk(BuildFlags Flags)
|
||||
{
|
||||
//PrintColorMessage("Copying Plugin SDK...", ConsoleColor.Cyan);
|
||||
|
||||
if (!CopyTextFiles())
|
||||
return false;
|
||||
if (!CopyPluginSdkHeaders())
|
||||
return false;
|
||||
if (!CopyVersionHeader())
|
||||
return false;
|
||||
if (!FixupResourceHeader())
|
||||
return false;
|
||||
if (!CopyLibFiles(Flags))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool BuildSetupExe()
|
||||
{
|
||||
Program.PrintColorMessage(BuildTimeStamp(), ConsoleColor.DarkGray, false);
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<AssemblyName>CustomBuildTool</AssemblyName>
|
||||
<OutputType>Exe</OutputType>
|
||||
<Platforms>x64;x86</Platforms>
|
||||
<PublishTrimmed>true</PublishTrimmed>
|
||||
@@ -9,20 +8,21 @@
|
||||
<PublishSingleFile>true</PublishSingleFile>
|
||||
<PublishReadyToRunShowWarnings>true</PublishReadyToRunShowWarnings>
|
||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||
<OutDir>$(SolutionDir)bin\$(Configuration)$(PlatformArchitecture)\$(TargetFramework)\</OutDir>
|
||||
<IntDir>$(SolutionDir)obj\$(Configuration)$(PlatformArchitecture)\$(TargetFramework)\</IntDir>
|
||||
<RuntimeIdentifiers>win-x86;win-x64</RuntimeIdentifiers>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Platform)'=='x86'">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<RuntimeIdentifiers>win-x86</RuntimeIdentifiers>
|
||||
<RuntimeIdentifier>win-x86</RuntimeIdentifier>
|
||||
<IntDir>$(SolutionDir)obj\$(Configuration)\$(TargetFramework)-$(PlatformTarget)\</IntDir>
|
||||
<OutDir>$(SolutionDir)bin\$(Configuration)\$(TargetFramework)-$(PlatformTarget)\</OutDir>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Platform)'=='x64'">
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<RuntimeIdentifiers>win-x64</RuntimeIdentifiers>
|
||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||
<IntDir>$(SolutionDir)obj\$(Configuration)\\$(TargetFramework)-$(PlatformTarget)\</IntDir>
|
||||
<OutDir>$(SolutionDir)bin\$(Configuration)\\$(TargetFramework)-$(PlatformTarget)\</OutDir>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x86'">
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* Process Hacker Toolchain -
|
||||
* Build script
|
||||
*
|
||||
* Copyright (C) 2017 dmex
|
||||
* Copyright (C) dmex
|
||||
*
|
||||
* This file is part of Process Hacker.
|
||||
*
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* Process Hacker Toolchain -
|
||||
* Build script
|
||||
*
|
||||
* Copyright (C) 2017 dmex
|
||||
* Copyright (C) dmex
|
||||
*
|
||||
* This file is part of Process Hacker.
|
||||
*
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* Process Hacker Toolchain -
|
||||
* Build script
|
||||
*
|
||||
* Copyright (C) 2017 dmex
|
||||
* Copyright (C) dmex
|
||||
*
|
||||
* This file is part of Process Hacker.
|
||||
*
|
||||
@@ -30,24 +30,6 @@ namespace CustomBuildTool
|
||||
{
|
||||
public static Dictionary<string, string> ProgramArgs;
|
||||
|
||||
private static bool BuildSdk(BuildFlags Flags)
|
||||
{
|
||||
//PrintColorMessage("Copying Plugin SDK...", ConsoleColor.Cyan);
|
||||
|
||||
if (!Build.CopyTextFiles())
|
||||
return false;
|
||||
if (!Build.CopyPluginSdkHeaders())
|
||||
return false;
|
||||
if (!Build.CopyVersionHeader())
|
||||
return false;
|
||||
if (!Build.FixupResourceHeader())
|
||||
return false;
|
||||
if (!Build.CopyLibFiles(Flags))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
ProgramArgs = ParseArgs(args);
|
||||
@@ -85,7 +67,7 @@ namespace CustomBuildTool
|
||||
BuildFlags.BuildDebug
|
||||
);
|
||||
|
||||
BuildSdk(
|
||||
Build.BuildSdk(
|
||||
BuildFlags.Build32bit | BuildFlags.Build64bit |
|
||||
BuildFlags.BuildDebug | BuildFlags.BuildVerbose
|
||||
);
|
||||
@@ -100,7 +82,11 @@ namespace CustomBuildTool
|
||||
return;
|
||||
}
|
||||
|
||||
BuildSdk(BuildFlags.Build32bit | BuildFlags.Build64bit | BuildFlags.BuildVerbose);
|
||||
Build.BuildSdk(
|
||||
BuildFlags.Build32bit |
|
||||
BuildFlags.Build64bit |
|
||||
BuildFlags.BuildVerbose
|
||||
);
|
||||
|
||||
Build.ShowBuildStats();
|
||||
}
|
||||
@@ -119,7 +105,8 @@ namespace CustomBuildTool
|
||||
BuildFlags.Build32bit | BuildFlags.Build64bit | BuildFlags.BuildVerbose))
|
||||
return;
|
||||
|
||||
if (!BuildSdk(BuildFlags.Build32bit | BuildFlags.Build64bit | BuildFlags.BuildVerbose))
|
||||
if (!Build.BuildSdk(
|
||||
BuildFlags.Build32bit | BuildFlags.Build64bit | BuildFlags.BuildVerbose))
|
||||
return;
|
||||
|
||||
if (!Build.BuildSolution("plugins\\Plugins.sln",
|
||||
@@ -155,7 +142,7 @@ namespace CustomBuildTool
|
||||
BuildFlags.BuildDebug | BuildFlags.BuildVerbose))
|
||||
return;
|
||||
|
||||
if (!BuildSdk(
|
||||
if (!Build.BuildSdk(
|
||||
BuildFlags.Build32bit | BuildFlags.Build64bit |
|
||||
BuildFlags.BuildDebug | BuildFlags.BuildVerbose
|
||||
))
|
||||
@@ -195,7 +182,7 @@ namespace CustomBuildTool
|
||||
if (!Build.CopyKProcessHacker(BuildFlags.Build32bit | BuildFlags.Build64bit | BuildFlags.BuildVerbose))
|
||||
Environment.Exit(1);
|
||||
|
||||
if (!BuildSdk(BuildFlags.Build32bit | BuildFlags.Build64bit | BuildFlags.BuildVerbose))
|
||||
if (!Build.BuildSdk(BuildFlags.Build32bit | BuildFlags.Build64bit | BuildFlags.BuildVerbose))
|
||||
Environment.Exit(1);
|
||||
|
||||
if (!Build.BuildSolution("plugins\\Plugins.sln",
|
||||
@@ -232,6 +219,44 @@ namespace CustomBuildTool
|
||||
if (!Build.BuildDeployUpdateConfig())
|
||||
Environment.Exit(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
Build.ShowBuildEnvironment("release", true);
|
||||
Build.CopyKeyFiles();
|
||||
|
||||
if (!Build.BuildSolution("ProcessHacker.sln",
|
||||
BuildFlags.Build32bit | BuildFlags.Build64bit |
|
||||
BuildFlags.BuildVerbose | BuildFlags.BuildApi
|
||||
))
|
||||
return;
|
||||
|
||||
if (!Build.CopyKProcessHacker(BuildFlags.Build32bit | BuildFlags.Build64bit | BuildFlags.BuildVerbose))
|
||||
return;
|
||||
|
||||
if (!Build.BuildSdk(BuildFlags.Build32bit | BuildFlags.Build64bit | BuildFlags.BuildVerbose))
|
||||
return;
|
||||
|
||||
if (!Build.BuildSolution("plugins\\Plugins.sln",
|
||||
BuildFlags.Build32bit | BuildFlags.Build64bit |
|
||||
BuildFlags.BuildVerbose | BuildFlags.BuildApi
|
||||
))
|
||||
return;
|
||||
|
||||
if (!Build.CopyWow64Files(BuildFlags.None))
|
||||
return;
|
||||
if (!Build.CopySidCapsFile(BuildFlags.Build32bit | BuildFlags.Build64bit | BuildFlags.BuildVerbose))
|
||||
return;
|
||||
|
||||
if (!Build.BuildBinZip())
|
||||
return;
|
||||
if (!Build.BuildSetupExe())
|
||||
return;
|
||||
Build.BuildPdbZip();
|
||||
Build.BuildSdkZip();
|
||||
Build.BuildSrcZip();
|
||||
|
||||
Build.ShowBuildStats();
|
||||
}
|
||||
//else if (ProgramArgs.ContainsKey("-appxbuild"))
|
||||
//{
|
||||
// Build.ShowBuildEnvironment("appx", true, true);
|
||||
@@ -261,55 +286,17 @@ namespace CustomBuildTool
|
||||
//
|
||||
// Build.ShowBuildStats();
|
||||
//}
|
||||
else if (ProgramArgs.ContainsKey("-appxmakecert"))
|
||||
{
|
||||
if (Restart("-appxmakecert"))
|
||||
return;
|
||||
|
||||
Build.ShowBuildEnvironment("appxcert", true);
|
||||
|
||||
Build.BuildAppxSignature();
|
||||
|
||||
Build.ShowBuildStats();
|
||||
}
|
||||
else
|
||||
{
|
||||
Build.ShowBuildEnvironment("release", true);
|
||||
Build.CopyKeyFiles();
|
||||
|
||||
if (!Build.BuildSolution("ProcessHacker.sln",
|
||||
BuildFlags.Build32bit | BuildFlags.Build64bit |
|
||||
BuildFlags.BuildVerbose | BuildFlags.BuildApi
|
||||
))
|
||||
return;
|
||||
|
||||
if (!Build.CopyKProcessHacker(BuildFlags.Build32bit | BuildFlags.Build64bit | BuildFlags.BuildVerbose))
|
||||
return;
|
||||
|
||||
if (!BuildSdk(BuildFlags.Build32bit | BuildFlags.Build64bit | BuildFlags.BuildVerbose))
|
||||
return;
|
||||
|
||||
if (!Build.BuildSolution("plugins\\Plugins.sln",
|
||||
BuildFlags.Build32bit | BuildFlags.Build64bit |
|
||||
BuildFlags.BuildVerbose | BuildFlags.BuildApi
|
||||
))
|
||||
return;
|
||||
|
||||
if (!Build.CopyWow64Files(BuildFlags.None))
|
||||
return;
|
||||
if (!Build.CopySidCapsFile(BuildFlags.Build32bit | BuildFlags.Build64bit | BuildFlags.BuildVerbose))
|
||||
return;
|
||||
|
||||
if (!Build.BuildBinZip())
|
||||
return;
|
||||
if (!Build.BuildSetupExe())
|
||||
return;
|
||||
Build.BuildPdbZip();
|
||||
Build.BuildSdkZip();
|
||||
Build.BuildSrcZip();
|
||||
|
||||
Build.ShowBuildStats();
|
||||
}
|
||||
//else if (ProgramArgs.ContainsKey("-appxmakecert"))
|
||||
//{
|
||||
// if (Restart("-appxmakecert"))
|
||||
// return;
|
||||
//
|
||||
// Build.ShowBuildEnvironment("appxcert", true);
|
||||
//
|
||||
// Build.BuildAppxSignature();
|
||||
//
|
||||
// Build.ShowBuildStats();
|
||||
//}
|
||||
}
|
||||
|
||||
private static Dictionary<string, string> ParseArgs(string[] args)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* Process Hacker Toolchain -
|
||||
* Build script
|
||||
*
|
||||
* Copyright (C) 2017 dmex
|
||||
* Copyright (C) dmex
|
||||
*
|
||||
* This file is part of Process Hacker.
|
||||
*
|
||||
@@ -263,42 +263,47 @@ namespace CustomBuildTool
|
||||
{
|
||||
public static string GetGitFilePath()
|
||||
{
|
||||
string GitExePath = Win32.SearchFile("git.exe");
|
||||
string git = Win32.SearchFile("git.exe");
|
||||
|
||||
if (File.Exists(GitExePath))
|
||||
return GitExePath;
|
||||
else
|
||||
{
|
||||
GitExePath = Environment.ExpandEnvironmentVariables("%ProgramFiles%\\git\\bin\\git.exe");
|
||||
if (File.Exists(git))
|
||||
return git;
|
||||
|
||||
if (!File.Exists(GitExePath) && Environment.Is64BitOperatingSystem)
|
||||
GitExePath = Environment.ExpandEnvironmentVariables("%ProgramW6432%\\git\\bin\\git.exe");
|
||||
git = Environment.ExpandEnvironmentVariables("%ProgramFiles%\\Git\\bin\\git.exe");
|
||||
|
||||
if (File.Exists(GitExePath))
|
||||
return GitExePath;
|
||||
}
|
||||
if (File.Exists(git))
|
||||
return git;
|
||||
|
||||
git = Environment.ExpandEnvironmentVariables("%ProgramFiles(x86)%\\Git\\bin\\git.exe");
|
||||
|
||||
if (File.Exists(git))
|
||||
return git;
|
||||
|
||||
git = Environment.ExpandEnvironmentVariables("%ProgramW6432%\\Git\\bin\\git.exe");
|
||||
|
||||
if (File.Exists(git))
|
||||
return git;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static string GetOutputDirectoryPath()
|
||||
{
|
||||
if (File.Exists(Environment.CurrentDirectory + "\\build\\output"))
|
||||
{
|
||||
return Environment.CurrentDirectory + "\\build\\output";
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
Directory.CreateDirectory(Environment.CurrentDirectory + "\\build\\output");
|
||||
string folder = Environment.CurrentDirectory + "\\build\\output";
|
||||
|
||||
return Environment.CurrentDirectory + "\\build\\output";
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Program.PrintColorMessage("Error creating output directory. " + ex, ConsoleColor.Red);
|
||||
}
|
||||
if (File.Exists(folder))
|
||||
{
|
||||
return folder;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
Directory.CreateDirectory(folder);
|
||||
|
||||
return folder;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Program.PrintColorMessage("Error creating output directory. " + ex, ConsoleColor.Red);
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -330,12 +335,13 @@ namespace CustomBuildTool
|
||||
};
|
||||
|
||||
string vswhere = Environment.ExpandEnvironmentVariables("%ProgramFiles%\\Microsoft Visual Studio\\Installer\\vswhere.exe");
|
||||
//vswhere = Environment.ExpandEnvironmentVariables("%ProgramFiles(x86)%\\Microsoft Visual Studio\\Installer\\vswhere.exe");
|
||||
|
||||
if (!File.Exists(vswhere) && Environment.Is64BitOperatingSystem)
|
||||
if (!File.Exists(vswhere))
|
||||
vswhere = Environment.ExpandEnvironmentVariables("%ProgramFiles(x86)%\\Microsoft Visual Studio\\Installer\\vswhere.exe");
|
||||
|
||||
if (!File.Exists(vswhere))
|
||||
vswhere = Environment.ExpandEnvironmentVariables("%ProgramW6432%\\Microsoft Visual Studio\\Installer\\vswhere.exe");
|
||||
|
||||
// Note: vswere.exe was only released with build 15.0.26418.1
|
||||
if (File.Exists(vswhere))
|
||||
{
|
||||
string vswhereResult = Win32.ShellExecute(vswhere,
|
||||
@@ -443,7 +449,7 @@ namespace CustomBuildTool
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Program.PrintColorMessage("[VisualStudioInstance] " + ex, ConsoleColor.Red, true);
|
||||
Program.PrintColorMessage("[UpdateBuildVersion] " + ex, ConsoleColor.Red, true);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -467,42 +473,6 @@ namespace CustomBuildTool
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private static VisualStudioInstance FindVisualStudioInstance()
|
||||
{
|
||||
var setupConfiguration = new SetupConfiguration() as ISetupConfiguration2;
|
||||
var instanceEnumerator = setupConfiguration.EnumAllInstances();
|
||||
var instances = new ISetupInstance2[3];
|
||||
|
||||
instanceEnumerator.Next(instances.Length, instances, out var instancesFetched);
|
||||
|
||||
if (instancesFetched == 0)
|
||||
return null;
|
||||
|
||||
do
|
||||
{
|
||||
for (int i = 0; i < instancesFetched; i++)
|
||||
{
|
||||
var instance = new VisualStudioInstance(instances[i]);
|
||||
var state = instances[i].GetState();
|
||||
var packages = instances[i].GetPackages().Where(package => package.GetId().Contains("Microsoft.Component.MSBuild"));
|
||||
|
||||
if (
|
||||
state.HasFlag(InstanceState.Local | InstanceState.Registered | InstanceState.Complete) &&
|
||||
packages.Count() > 0 &&
|
||||
instance.Version.StartsWith("15.0", StringComparison.OrdinalIgnoreCase)
|
||||
)
|
||||
{
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
|
||||
instanceEnumerator.Next(instances.Length, instances, out instancesFetched);
|
||||
}
|
||||
while (instancesFetched != 0);
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public class VisualStudioInstance
|
||||
@@ -547,12 +517,6 @@ namespace CustomBuildTool
|
||||
{
|
||||
this.InstallDate = DateTime.UtcNow;
|
||||
}
|
||||
|
||||
// FromInstance.GetState();
|
||||
// FromInstance.GetPackages();
|
||||
// FromInstance.GetProduct();
|
||||
// FromInstance.GetProperties();
|
||||
// FromInstance.GetErrors();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* Process Hacker Toolchain -
|
||||
* Build script
|
||||
*
|
||||
* Copyright (C) 2017 dmex
|
||||
* Copyright (C) dmex
|
||||
*
|
||||
* This file is part of Process Hacker.
|
||||
*
|
||||
@@ -130,4 +130,4 @@ namespace CustomBuildTool
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user