Browse Source

Using Visual Studio 2022 and its Build tools and (Test) Agent

VS2022 installs to 64-bit Program files. Builds Tools and Agent still installs to 32-bil. But Agent is 64-bit actually, what breaks some advanced P/Invoke. For now, explicitly targeting 32-bit as a workaround.

Getting rid of VS2017 Build Tools dependency in puttyvs, by re-targeting the project.

Reusing buildenv.bat in Packages-make.bat

Source commit: f79e09f3529cc9e649741772bd8ecfabed3ecb2d
Martin Prikryl 2 years ago
parent
commit
c824c4cc4d
3 changed files with 16 additions and 7 deletions
  1. 12 3
      build.bat
  2. 3 3
      libs/puttyvs/PuTTYVS.vcxproj
  3. 1 1
      readme.md

+ 12 - 3
build.bat

@@ -1,9 +1,18 @@
 @echo off
 rem See 'readme' file
-if "%PROCESSOR_ARCHITECTURE%"=="x86" set PROGRAMFILES32=%ProgramFiles%
-if "%PROCESSOR_ARCHITECTURE%"=="AMD64" set PROGRAMFILES32=%ProgramFiles(x86)%
+if "%PROCESSOR_ARCHITECTURE%"=="x86" (
+  set PROGRAMFILES32=%ProgramFiles%
+  set PROGRAMFILES64=%ProgramW6432%
+) else if "%PROCESSOR_ARCHITECTURE%"=="AMD64" (
+  set PROGRAMFILES32=%ProgramFiles(x86)%
+  set PROGRAMFILES64=%ProgramFiles%
+) else (
+  echo Unrecognized architecture %PROCESSOR_ARCHITECTURE%
+  exit
+)
+
 set BDS=%PROGRAMFILES32%\Embarcadero\Studio\14.0
-set MSBUILD=%PROGRAMFILES32%\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe
+set MSBUILD=%PROGRAMFILES64%\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin\MSBuild.exe
 
 set WITH_DOTNET=1
 if "%BUILD_TARGET%"=="" set BUILD_TARGET=Build

+ 3 - 3
libs/puttyvs/PuTTYVS.vcxproj

@@ -14,19 +14,19 @@
     <ProjectGuid>{72E46F2A-361D-490E-B8A2-C5CD8D56C3A6}</ProjectGuid>
     <Keyword>Win32Proj</Keyword>
     <RootNamespace>PuTTYVS</RootNamespace>
-    <WindowsTargetPlatformVersion>10.0.18362.0</WindowsTargetPlatformVersion>
+    <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
   </PropertyGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
     <ConfigurationType>StaticLibrary</ConfigurationType>
     <UseDebugLibraries>false</UseDebugLibraries>
-    <PlatformToolset>v141</PlatformToolset>
+    <PlatformToolset>v143</PlatformToolset>
     <CharacterSet>Unicode</CharacterSet>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
     <ConfigurationType>StaticLibrary</ConfigurationType>
     <UseDebugLibraries>false</UseDebugLibraries>
-    <PlatformToolset>v141</PlatformToolset>
+    <PlatformToolset>v143</PlatformToolset>
     <CharacterSet>Unicode</CharacterSet>
   </PropertyGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />

+ 1 - 1
readme.md

@@ -2,7 +2,7 @@
 
 To build WinSCP you need:
 - [Embarcadero C++ Builder XE6 Professional](https://www.embarcadero.com/products/cbuilder).
-- [Build Tools and Agents for Visual Studio 2019](https://visualstudio.microsoft.com/) (for C# 9.0)
+- [Build Tools and Agents for Visual Studio 2022](https://visualstudio.microsoft.com/downloads/) (for C# 9.0)
 - [nasm](https://www.nasm.us/) (store it to `buildtools/tools/nasm.exe`)
 - [Object file converter](https://www.agner.org/optimize/#objconv) (store it to `buildtools/tools/objconv.exe`)