diff --git a/Scripts/Build-Solution.ps1 b/Scripts/Build-Solution.ps1 index 20f7988..160a7fa 100644 --- a/Scripts/Build-Solution.ps1 +++ b/Scripts/Build-Solution.ps1 @@ -14,7 +14,7 @@ $modulePath = Join-Path $PSScriptRoot 'Modules\Invoke-MSBuild' Import-Module $modulePath -ErrorAction Stop $targets = 'Build' # 'Clean' -$configurations = 'Release' # 'Debug' +$configurations = 'Release', 'Debug' $platforms = 'x86','x64' # Delete the entire Build directory @@ -34,7 +34,7 @@ foreach($target in $targets) $logDir = Join-Path $logRootDir "$configuration\$platform" mkdir $logDir -Force | Out-Null $result = Invoke-MsBuild -MsBuildParameters "/target:$target /property:Configuration=$configuration;Platform=$platform" ` - -Path $solutionFile -ShowBuildWindow -BuildLogDirectoryPath $logDir -KeepBuildLogOnSuccessfulBuilds + -Path $solutionFile -BuildLogDirectoryPath $logDir -KeepBuildLogOnSuccessfulBuilds echo "Success: $result" } } diff --git a/Scripts/Modules/Invoke-MSBuild/Invoke-MsBuild.psm1 b/Scripts/Modules/Invoke-MSBuild/Invoke-MsBuild.psm1 index 66bf5ee..c982b62 100644 --- a/Scripts/Modules/Invoke-MSBuild/Invoke-MsBuild.psm1 +++ b/Scripts/Modules/Invoke-MSBuild/Invoke-MsBuild.psm1 @@ -311,10 +311,16 @@ function Get-VisualStudioCommandPromptPath $vs2012CommandPrompt = $env:VS110COMNTOOLS + "VsDevCmd.bat" $vs2013CommandPrompt = $env:VS120COMNTOOLS + "VsDevCmd.bat" $vs2015CommandPrompt = $env:VS140COMNTOOLS + "VsDevCmd.bat" - + + # We have to use the vswhere.exe tool to locate Visual Studio 2017 + $vsWhere = Join-Path $PSScriptRoot '..\..\Tools\vswhere.exe' + $vs2017Instance = & $vsWhere -nologo -format value -property installationPath -latest -requires 'Microsoft.VisualStudio.Component.VC.CLI.Support' + $vs2017CommandPrompt = Join-Path $vs2017Instance 'Common7\Tools\VsDevCmd.bat' + # Store the VS Command Prompt to do the build in, if one exists. $vsCommandPrompt = $null - if (Test-Path $vs2015CommandPrompt) { $vsCommandPrompt = $vs2015CommandPrompt } + if (Test-Path $vs2017CommandPrompt) { $vsCommandPrompt = $vs2017CommandPrompt } + elseif (Test-Path $vs2015CommandPrompt) { $vsCommandPrompt = $vs2015CommandPrompt } elseif (Test-Path $vs2013CommandPrompt) { $vsCommandPrompt = $vs2013CommandPrompt } elseif (Test-Path $vs2012CommandPrompt) { $vsCommandPrompt = $vs2012CommandPrompt } elseif (Test-Path $vs2010CommandPrompt) { $vsCommandPrompt = $vs2010CommandPrompt } diff --git a/Scripts/Modules/Invoke-MSTest/Invoke-MsTest.psm1 b/Scripts/Modules/Invoke-MSTest/Invoke-MsTest.psm1 index 54188aa..017df0b 100644 --- a/Scripts/Modules/Invoke-MSTest/Invoke-MsTest.psm1 +++ b/Scripts/Modules/Invoke-MSTest/Invoke-MsTest.psm1 @@ -365,7 +365,7 @@ function Get-MsTest #> - $MsTest = "$(Get-VsCommonTools)..\IDE\MsTest.exe" + $MsTest = Join-Path (Get-VsCommonTools) '..\IDE\MsTest.exe' if (Test-Path $MsTest) {$MsTest} else {Write-Error "Unable to find MsTest.exe"} } @@ -381,10 +381,23 @@ function Get-VsCommonTools Current list supports VS14, VS12, VS11 and VS10, you may need to add to this list to satisfy your needs. #> - - $VsCommonToolsPaths = @(@($env:VS140COMNTOOLS,$env:VS120COMNTOOLS,$env:VS110COMNTOOLS,$env:VS100COMNTOOLS) | Where-Object {$_ -ne $null}) - if ($VsCommonToolsPaths.Count -ne 0) {$VsCommonToolsPaths[0]} - else {Write-Error "Unable to find Visual Studio Common Tool Path."} + + # We have to use the vswhere.exe tool to locate Visual Studio 2017 + $vsWhere = Join-Path $PSScriptRoot '..\..\Tools\vswhere.exe' + $vs141Instance = & $vsWhere -nologo -format value -property installationPath -latest -requires 'Microsoft.VisualStudio.Component.VC.CLI.Support' + $VS141COMNTOOLS = Join-Path $vs141Instance 'Common7\Tools' + + # Now test which VS versions are present on the system + $VsCommonToolsPath = @($VS141COMNTOOLS,$env:VS140COMNTOOLS,$env:VS120COMNTOOLS,$env:VS110COMNTOOLS,$env:VS100COMNTOOLS) | + Where-Object { $_ -ne $null -and (Test-Path -Path $_ -PathType Container) } | + Select-Object -First 1 + + if ($VsCommonToolsPath -eq $null) + { + Write-Error "Unable to find Visual Studio Common Tool Path." + } + + return $VsCommonToolsPath } ################################################################################ -Export-ModuleMember -Function Invoke-MsTest,Get-MsTest +Export-ModuleMember -Function Invoke-MsTest,Get-MsTest \ No newline at end of file diff --git a/Scripts/Run-Tests.ps1 b/Scripts/Run-Tests.ps1 index cfd961a..c406e36 100644 --- a/Scripts/Run-Tests.ps1 +++ b/Scripts/Run-Tests.ps1 @@ -21,7 +21,6 @@ mkdir $resultsDir -Force | Out-Null # Execute all Visual Studio Unit Tests Get-ChildItem -Path $buildDir -Filter *.Test.dll -File -Recurse | foreach { $unitTestFile = $_.FullName - #Split-Path $_.Name - $resultsFile = Join-Path $resultsDir ($_.BaseName + '.trx') & $msTest /testcontainer:$unitTestFile /resultsfile:$resultsFile /runconfig:$runConfig } diff --git a/Scripts/Tools/nuget.exe b/Scripts/Tools/nuget.exe index 324daa8..13a2637 100644 Binary files a/Scripts/Tools/nuget.exe and b/Scripts/Tools/nuget.exe differ diff --git a/Scripts/Tools/vswhere.exe b/Scripts/Tools/vswhere.exe new file mode 100644 index 0000000..ac8e8fb Binary files /dev/null and b/Scripts/Tools/vswhere.exe differ diff --git a/Src/DSInternals.Replication.Interop/DSInternals.Replication.Interop.vcxproj b/Src/DSInternals.Replication.Interop/DSInternals.Replication.Interop.vcxproj index 9f390e1..11e8f36 100644 --- a/Src/DSInternals.Replication.Interop/DSInternals.Replication.Interop.vcxproj +++ b/Src/DSInternals.Replication.Interop/DSInternals.Replication.Interop.vcxproj @@ -1,5 +1,5 @@ - - + + ..\ @@ -34,7 +34,7 @@ ManagedCProj DSInternals.Replication.Interop DSInternals.Replication.Interop - 7 + 10.0.14393.0 @@ -273,14 +273,24 @@ - + + $(VCInstallDir)\redist\x64\Microsoft.VC$(PlatformToolsetVersion).CRT $(VCInstallDir)\redist\x86\Microsoft.VC$(PlatformToolsetVersion).CRT + + + $(VCInstallDir)\Redist\MSVC\$(VCToolsVersion)\onecore\x64\Microsoft.VC150.CRT + $(VCInstallDir)\Redist\MSVC\$(VCToolsVersion)\onecore\x86\Microsoft.VC150.CRT + - xcopy.exe /D /Y "$(VCRuntimePath)\msvc*.dll" "$(OutDir)" - msvcr$(PlatformToolsetVersion).dll;msvcp$(PlatformToolsetVersion).dll + + + xcopy.exe /D /Y "$(VCRuntimePath)\msvc*.dll" "$(OutDir)" + xcopy.exe /D /Y "$(VCRuntimePath)\vcruntime*.dll" "$(OutDir)" + + $(OutDir)\msvcr$(PlatformToolsetVersion).dll;$(OutDir)\msvcp$(PlatformToolsetVersion).dll;$(OutDir)\vcruntime$(PlatformToolsetVersion).dll Copying VC Runtime diff --git a/Src/DSInternals.Replication.Interop/DrsConnection.cpp b/Src/DSInternals.Replication.Interop/DrsConnection.cpp index fd30bf4..e17db87 100644 --- a/Src/DSInternals.Replication.Interop/DrsConnection.cpp +++ b/Src/DSInternals.Replication.Interop/DrsConnection.cpp @@ -246,11 +246,9 @@ namespace DSInternals // Force the validator to throw the DRA access denied exception. Validator::AssertSuccess(Win32ErrorCode::DS_DRA_ACCESS_DENIED); } - else - { - // Rethrow the original exception, as the object really does not exists. - throw; - } + + // Rethrow the original exception otherwise, as the object really does not exists. + throw; } } @@ -278,11 +276,9 @@ namespace DSInternals // Force the validator to throw the DRA access denied exception. Validator::AssertSuccess(Win32ErrorCode::DS_DRA_ACCESS_DENIED); } - else - { - // Rethrow the original exception, as the object really does not exists. - throw; - } + + // Rethrow the original exception otherwise, as the object really does not exists. + throw; } } diff --git a/Src/DSInternals.Replication.Interop/RpcTypeConverter.cpp b/Src/DSInternals.Replication.Interop/RpcTypeConverter.cpp index b83a954..855fbae 100644 --- a/Src/DSInternals.Replication.Interop/RpcTypeConverter.cpp +++ b/Src/DSInternals.Replication.Interop/RpcTypeConverter.cpp @@ -30,7 +30,7 @@ namespace DSInternals uuid.Data4[6], uuid.Data4[7]); } - array^ RpcTypeConverter::ToReplicationCursors(midl_ptr &&nativeCursors) + cli::array^ RpcTypeConverter::ToReplicationCursors(midl_ptr &&nativeCursors) { if (!nativeCursors) { @@ -38,7 +38,7 @@ namespace DSInternals } DWORD numCursors = nativeCursors->cNumCursors; - auto managedCursors = gcnew array(numCursors); + auto managedCursors = gcnew cli::array(numCursors); // Process all cursors, one-by-one for (DWORD i = 0; i < numCursors; i++)