Merge branch 'vs_2017'

This commit is contained in:
MichaelGrafnetter 2017-03-11 08:54:30 +01:00
commit d5e665b317
9 changed files with 53 additions and 29 deletions

View File

@ -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"
}
}

View File

@ -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 }

View File

@ -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

View File

@ -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
}

Binary file not shown.

BIN
Scripts/Tools/vswhere.exe Normal file

Binary file not shown.

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<!-- NuGet workaround (it does not support passing variables into referenced projects) -->
<SolutionDir Condition="$(SolutionDir) == ''">..\</SolutionDir>
@ -34,7 +34,7 @@
<Keyword>ManagedCProj</Keyword>
<RootNamespace>DSInternals.Replication.Interop</RootNamespace>
<ProjectName>DSInternals.Replication.Interop</ProjectName>
<WindowsTargetPlatformVersion>7</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0.14393.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
@ -273,14 +273,24 @@
</Midl>
</ItemGroup>
<!-- Visual C++ Runtime Redistribution -->
<PropertyGroup>
<PropertyGroup Condition=" '$(PlatformToolsetVersion)' &lt; 141 ">
<!-- Definitions for Visual Studio 2013 and 2015 -->
<VCRuntimePath Condition=" '$(Platform)'=='x64' ">$(VCInstallDir)\redist\x64\Microsoft.VC$(PlatformToolsetVersion).CRT</VCRuntimePath>
<VCRuntimePath Condition=" '$(Platform)'=='Win32' ">$(VCInstallDir)\redist\x86\Microsoft.VC$(PlatformToolsetVersion).CRT</VCRuntimePath>
</PropertyGroup>
<PropertyGroup Condition=" '$(PlatformToolsetVersion)' &gt;= 141 ">
<!-- Definitions for Visual Studio 2017 -->
<VCRuntimePath Condition=" '$(Platform)'=='x64' ">$(VCInstallDir)\Redist\MSVC\$(VCToolsVersion)\onecore\x64\Microsoft.VC150.CRT</VCRuntimePath>
<VCRuntimePath Condition=" '$(Platform)'=='Win32' ">$(VCInstallDir)\Redist\MSVC\$(VCToolsVersion)\onecore\x86\Microsoft.VC150.CRT</VCRuntimePath>
</PropertyGroup>
<ItemDefinitionGroup>
<CustomBuildStep>
<Command>xcopy.exe /D /Y "$(VCRuntimePath)\msvc*.dll" "$(OutDir)"</Command>
<Outputs>msvcr$(PlatformToolsetVersion).dll;msvcp$(PlatformToolsetVersion).dll</Outputs>
<!-- Note: The msvcr140.dll file has been replaced by vcruntime140.dll since Visual Studio 2017. -->
<Command>
xcopy.exe /D /Y "$(VCRuntimePath)\msvc*.dll" "$(OutDir)"
xcopy.exe /D /Y "$(VCRuntimePath)\vcruntime*.dll" "$(OutDir)"
</Command>
<Outputs>$(OutDir)\msvcr$(PlatformToolsetVersion).dll;$(OutDir)\msvcp$(PlatformToolsetVersion).dll;$(OutDir)\vcruntime$(PlatformToolsetVersion).dll</Outputs>
<Message>Copying VC Runtime</Message>
</CustomBuildStep>
</ItemDefinitionGroup>

View File

@ -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;
}
}

View File

@ -30,7 +30,7 @@ namespace DSInternals
uuid.Data4[6], uuid.Data4[7]);
}
array<ReplicationCursor^>^ RpcTypeConverter::ToReplicationCursors(midl_ptr<DS_REPL_CURSORS> &&nativeCursors)
cli::array<ReplicationCursor^>^ RpcTypeConverter::ToReplicationCursors(midl_ptr<DS_REPL_CURSORS> &&nativeCursors)
{
if (!nativeCursors)
{
@ -38,7 +38,7 @@ namespace DSInternals
}
DWORD numCursors = nativeCursors->cNumCursors;
auto managedCursors = gcnew array<ReplicationCursor^>(numCursors);
auto managedCursors = gcnew cli::array<ReplicationCursor^>(numCursors);
// Process all cursors, one-by-one
for (DWORD i = 0; i < numCursors; i++)