diff --git a/gpii/node_modules/nativeSettingsHandler/nativeSolutions/VolumeControl/VolumeControl/VolumeControl.vcxproj b/gpii/node_modules/nativeSettingsHandler/nativeSolutions/VolumeControl/VolumeControl/VolumeControl.vcxproj
index 3556783b2..ca7b5028e 100644
--- a/gpii/node_modules/nativeSettingsHandler/nativeSolutions/VolumeControl/VolumeControl/VolumeControl.vcxproj
+++ b/gpii/node_modules/nativeSettingsHandler/nativeSolutions/VolumeControl/VolumeControl/VolumeControl.vcxproj
@@ -28,26 +28,26 @@
Application
true
- v140
+ v141
Unicode
Application
false
- v140
+ v141
true
Unicode
Application
true
- v140
+ v141
Unicode
Application
false
- v140
+ v141
true
Unicode
diff --git a/gpii/node_modules/nativeSettingsHandler/nativeSolutions/VolumeControl/VolumeControl/pch.h b/gpii/node_modules/nativeSettingsHandler/nativeSolutions/VolumeControl/VolumeControl/pch.h
index c94c19db5..fb16e4f72 100644
--- a/gpii/node_modules/nativeSettingsHandler/nativeSolutions/VolumeControl/VolumeControl/pch.h
+++ b/gpii/node_modules/nativeSettingsHandler/nativeSolutions/VolumeControl/VolumeControl/pch.h
@@ -11,4 +11,11 @@
// TODO: add headers that you want to pre-compile here
+/* NOTE: we declare IUnknown here to satisfy VS2017's compiler's conformant mode (using header files from the Windows 8.1 SDK)
+ * Link: https://developercommunity.visualstudio.com/content/problem/185399/error-c2760-in-combaseapih-with-windows-sdk-81-and.html
+ * note Stale L. Hansen's recommendation (after reviewing the full thread)
+ * [the alternative remedies are to either turn off conformant mode in the compiler for this project...or update to the Windows 10 SDK] */
+// Workaround for "combaseapi.h(229): error C2187: syntax error: 'identifier' was unexpected here" when using VS2017 compiler with "/permissive-" flag
+struct IUnknown;
+
#endif //PCH_H
diff --git a/package.json b/package.json
index 494f39919..4aec99453 100644
--- a/package.json
+++ b/package.json
@@ -19,7 +19,7 @@
"dependencies": {
"edge-js": "10.3.1",
"ffi-napi": "2.4.3",
- "gpii-universal": "0.3.0-dev.20200128T170154Z.eaac9112e",
+ "gpii-universal": "JavierJF/universal#GPII-3810",
"@pokusew/pcsclite": "0.4.18",
"ref": "1.3.4",
"ref-struct": "1.1.0",
diff --git a/provisioning/Npm.ps1 b/provisioning/Npm.ps1
index e8fed95f5..5d98a2013 100755
--- a/provisioning/Npm.ps1
+++ b/provisioning/Npm.ps1
@@ -13,7 +13,7 @@ Import-Module "$($originalBuildScriptPath)/Provisioning.psm1" -Force
$npm = "npm" -f $env:SystemDrive
-Invoke-Command $npm "config set msvs_version 2015 --global"
+Invoke-Command $npm "config set msvs_version 2017 --global"
Invoke-Command $npm "install grunt-cli -g"
Invoke-Command $npm "install testem -g"
refreshenv
diff --git a/provisioning/NpmInstall.ps1 b/provisioning/NpmInstall.ps1
index e379a9b46..c86d1ca38 100755
--- a/provisioning/NpmInstall.ps1
+++ b/provisioning/NpmInstall.ps1
@@ -7,21 +7,35 @@ $VerbosePreference = "continue"
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
$rootDir = Split-Path -Parent $scriptDir
+if (${Env:ProgramFiles(x86)}) {
+ $programFilesX86Path = ${Env:ProgramFiles(x86)}
+} else {
+ # This is required for compatibility with Intel 32-bit systems (since the ProgramFiles(x86) environment variable does not exist on 32-bit Windows)
+ $programFilesX86Path = ${Env:ProgramFiles}
+}
+$programFilesPath = ${Env:ProgramFiles}
+
# Include main Provisioning module.
Import-Module (Join-Path $scriptDir 'Provisioning.psm1') -Force -Verbose
-$msbuild = Get-MSBuild "4.0"
+# For Microsoft's build tools, we will accept any version >=15.0 and <16.0 (i.e. VS2017)
+$visualStudioVersion = "[15.0,16.0)"
+
+# Capture the full file path of MSBuild
+$msbuild = Get-MSBuild $visualStudioVersion
+
+# Capture the full file path of the C# compiler
+$csc = Get-CSharpCompiler $visualStudioVersion
# Build the settings helper
$settingsHelperDir = Join-Path $rootDir "settingsHelper"
-Invoke-Command $msbuild "SettingsHelper.sln /p:Configuration=Release /p:Platform=`"Any CPU`" /p:FrameworkPathOverride=`"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1`"" $settingsHelperDir
+Invoke-Command $msbuild "SettingsHelper.sln /p:Configuration=Release /p:Platform=`"Any CPU`" /p:FrameworkPathOverride=`"$($programFilesX86Path)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1`"" $settingsHelperDir
$volumeControlDir = Join-Path $rootDir "gpii\node_modules\nativeSettingsHandler\nativeSolutions\VolumeControl"
-Invoke-Command $msbuild "VolumeControl.sln /p:Configuration=Release /p:Platform=`"x86`" /p:FrameworkPathOverride=`"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1`"" $volumeControlDir
+Invoke-Command $msbuild "VolumeControl.sln /p:Configuration=Release /p:Platform=`"x86`" /p:FrameworkPathOverride=`"$($programFilesX86Path)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1`"" $volumeControlDir
# Build the process test helper
$testProcessHandlingDir = Join-Path $rootDir "gpii\node_modules\processHandling\test"
-$csc = Join-Path -Path (Split-Path -Parent $msbuild) csc.exe
Invoke-Command $csc "/target:exe /out:test-window.exe test-window.cs" $testProcessHandlingDir
# Build the Windows Service
diff --git a/provisioning/Provisioning.psm1 b/provisioning/Provisioning.psm1
index 69c704231..ba7a49363 100755
--- a/provisioning/Provisioning.psm1
+++ b/provisioning/Provisioning.psm1
@@ -48,21 +48,74 @@ Function Invoke-Command {
Function Get-MSBuild {
Param (
[Parameter(Mandatory=$true)]
- [string] $version
+ [string] $visualStudioVersion
)
- # TODO: Check version validity.
- # Valid versions are [2.0, 3.5, 4.0]
+ # Find the path to vswhere (which installed with Visual Studio 2017 or Build Tools 2017 or later)
+ $vswhere = Get-VSWhere
- $dotNetVersion = $version
- $regKey = "HKLM:\software\Microsoft\MSBuild\ToolsVersions\$dotNetVersion"
- $regProperty = "MSBuildToolsPath"
+ if (!$vswhere) {
+ throw "Visual Studio $($visualStudioVersion) or Build Tools $($visualStudioVersion) were not found."
+ }
- $msbuild = Join-Path -path (Get-ItemProperty $regKey).$regProperty -childpath "msbuild.exe"
+ # courtesy of Microsoft: https://github.com/microsoft/vswhere/wiki/Find-MSBuild/62adac8eb22431fa91d94e03503d76d48a74939c
+ $path = &$vswhere -version $visualStudioVersion -products * -requires Microsoft.Component.MSBuild -property installationPath
+ if ($path) {
+ $msbuild = Join-Path $path 'MSBuild\Current\Bin\MSBuild.exe'
+ if (-not (test-path $msbuild)) {
+ $msbuild = join-path $path 'MSBuild\15.0\Bin\MSBuild.exe'
+ if (-not (test-path $msbuild)) {
+ throw "MSBuild from Visual Studio $($visualStudioVersion) or Build Tools $($visualStudioVersion) could not be found"
+ }
+ }
+ }
return $msbuild
}
+Function Get-CSharpCompiler {
+ Param (
+ [Parameter(Mandatory=$true)]
+ [string] $visualStudioVersion
+ )
+
+ # Find the path to vswhere (which installed with Visual Studio 2017 or Build Tools 2017 or later)
+ $vswhere = Get-VSWhere
+
+ if (!$vswhere) {
+ throw "Visual Studio $($visualStudioVersion) or Build Tools $($visualStudioVersion) were not found."
+ }
+
+ # adapted from: https://github.com/microsoft/vswhere/wiki/Find-MSBuild/62adac8eb22431fa91d94e03503d76d48a74939c
+ $path = &$vswhere -version $visualStudioVersion -products * -requires Microsoft.VisualStudio.Component.Roslyn.Compiler -property installationPath
+ if ($path) {
+ $csc = Join-Path $path 'MSBuild\Current\Bin\Roslyn\csc.exe'
+ if (-not (test-path $csc)) {
+ $csc = join-path $path 'MSBuild\15.0\Bin\Roslyn\csc.exe'
+ if (-not (test-path $csc)) {
+ throw "csc from Visual Studio $($visualStudioVersion) or Build Tools $($visualStudioVersion) could not be found"
+ }
+ }
+ }
+
+ return $csc
+}
+
+Function Get-VSWhere {
+ # NOTE: this function is compatible with Visual Studio 2017+
+
+ # Valid Visual Studio versions options are [15.0, "[15.0,16.0)", etc.]
+
+ # Find the path to vswhere (which installed with Visual Studio 2017 or Build Tools 2017 or later)
+ if (${Env:ProgramFiles(x86)}) {
+ $vswhere = Join-Path ${Env:ProgramFiles(x86)} "Microsoft Visual Studio\Installer\vswhere.exe"
+ } else {
+ $vswhere = Join-Path ${Env:ProgramFiles} "Microsoft Visual Studio\Installer\vswhere.exe"
+ }
+
+ return $vswhere
+}
+
Function Invoke-Environment {
Param (
[Parameter(Mandatory=$true)]
@@ -108,5 +161,6 @@ Function Add-Path {
Export-ModuleMember -Function Invoke-Command
Export-ModuleMember -Function Get-MSBuild
+Export-ModuleMember -Function Get-CSharpCompiler
Export-ModuleMember -Function Invoke-Environment
Export-ModuleMember -Function Add-Path