Merge pull request #33 from zooba/ps-install

Adds PowerShell install script
This commit is contained in:
Steve Dower 2017-05-04 11:36:43 -07:00 коммит произвёл GitHub
Родитель 0853680b02 388848cf8c
Коммит 3523b0e777
3 изменённых файлов: 138 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,75 @@
param($vs)
$source = $MyInvocation.MyCommand.Definition | Split-Path -Parent
if (-not $vs) {
$vs = [Environment]::GetEnvironmentVariable("VisualStudio_15.0")
}
if (-not $vs) {
throw "-vs option must be specified"
}
if (-not (Test-Path $vs)) {
throw "specified path -vs $vs does not exist"
}
if (-not (Test-Path "$vs\Common7\IDE\devenv.exe")) {
throw "specified path -vs $vs does not contain a Visual Studio installation"
}
if (-not (Test-Path "$source\Microsoft.VisualStudioTools.VSTestHost.15.0.dll") -or
-not (Test-Path "$source\Microsoft.VisualStudioTools.VSTestHost.15.0.pkgdef")) {
throw "expected VSTestHost files in $source"
}
"Installing VSTestHost from $source"
copy "$source\Microsoft.VisualStudioTools.VSTestHost.15.0.dll" "$vs\Common7\IDE\CommonExtensions\Platform" -Force
copy "$source\Microsoft.VisualStudioTools.VSTestHost.15.0.pkgdef" "$vs\Common7\IDE\CommonExtensions\Platform" -Force
"Updating *.exe.config files"
gci @(
"$vs\Common7\IDE\MSTest.exe.config",
"$vs\Common7\IDE\QTAgent*.exe.config",
"$vs\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.*.exe.config"
) | ?{ Test-Path $_ } | %{
$conf = [xml](gc $_);
if (-not $conf.configuration.runtime.assemblyBinding.probing.privatePath.Contains("CommonExtensions\Microsoft\Editor")) {
$conf.configuration.runtime.assemblyBinding.probing.privatePath += ";CommonExtensions\Platform;CommonExtensions\Microsoft\Editor";
$n = $conf.configuration.runtime.assemblyBinding.AppendChild($conf.ImportNode(([xml]'<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/>
<bindingRedirect oldVersion="4.5.0.0-8.0.0.0" newVersion="8.0.0.0"/>
<codeBase version="8.0.0.0" href="PrivateAssemblies\Newtonsoft.Json.dll"/>
</dependentAssembly>').dependentAssembly, $true));
$conf.Save("$_");
" - $($_.Name)"
}
}
"Executing devenv /setup"
Start-Process -Wait -NoNewWindow "$vs\Common7\IDE\devenv.exe" "/setup"
"Generating testsettings files"
$ts = [xml](gc "$source\vs2017.testsettings.template")
foreach ($n in $ts.TestSettings.Execution.TestTypeSpecific.UnitTestRunConfig.AssemblyResolution.RuntimeResolution.Directory) {
$n.path = $n.path -replace '\$VSPath', "$vs";
$n.path = $n.path -replace '\$VSVersion', "15.0";
}
foreach ($n in $ts.TestSettings.Execution.TestTypeSpecific.UnitTestRunConfig.AssemblyResolution.DiscoveryResolution.Directory) {
$n.path = $n.path -replace '\$VSPath', "$vs";
$n.path = $n.path -replace '\$VSVersion', "15.0";
}
foreach ($n in $ts.TestSettings.Properties.Property) {
$n.value = $n.value -replace '\$VSPath', "$vs";
$n.value = $n.value -replace '\$VSVersion', "15.0";
}
$ts.Save("$vs\vstesthost.testsettings")
" - $vs\vstesthost.testsettings"
foreach ($n in $ts.TestSettings.Properties.Property) {
if ($n.name -eq "VSHive") {
$n.value = "Exp";
}
}
$ts.Save("$vs\vstesthost.exp.testsettings")
" - $vs\vstesthost.exp.testsettings"
""

Просмотреть файл

@ -141,6 +141,14 @@
<Content Include="Resources\Package.ico" />
<None Include="source.extension.vsixmanifest" />
</ItemGroup>
<ItemGroup>
<Content Include="InstallInVS2017.ps1">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="vs2017.testsettings.template">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<Import Project="$(TargetsPath)\Common.Build.targets" />
<Import Project="$(TargetsPath)\Common.Build.CSharp.targets" />
<Import Project="$(VSToolsPath)\VSSDK\Microsoft.VsSDK.targets" Condition="'$(VSToolsPath)' != ''" />

Просмотреть файл

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<TestSettings name="default" id="FBA3FF0E-57FA-403D-BD46-7A1DC123D369" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010">
<Description>Local test runs with Visual Studio 2017</Description>
<Execution>
<Timeouts runTimeout="7200000" testTimeout="300000" />
<TestTypeSpecific>
<UnitTestRunConfig testTypeId="13cdc9d9-ddb5-4fa4-a97d-d965ccfc6d4b">
<AssemblyResolution>
<TestDirectory useLoadContext="true" />
<RuntimeResolution>
<Directory path="$VSPath\MSBuild\$VSVersion\Bin" includeSubDirectories="false" />
<Directory path="$VSPath\Common7\IDE\PublicAssemblies" includeSubDirectories="false" />
<Directory path="$VSPath\Common7\IDE\PrivateAssemblies" includeSubDirectories="false" />
<Directory path="$VSPath\Common7\IDE\CommonExtensions\Microsoft\Editor" includeSubDirectories="false" />
<Directory path="$VSPath\Common7\IDE\CommonExtensions\Microsoft\TestWindow" includeSubDirectories="false" />
<Directory path="$VSPath\Common7\IDE\Extensions\Microsoft\Web Tools\Editors" includeSubDirectories="false" />
</RuntimeResolution>
<DiscoveryResolution>
<Directory path="$VSPath\MSBuild\$VSVersion\Bin" includeSubDirectories="false" />
<Directory path="$VSPath\Common7\IDE\PublicAssemblies" includeSubDirectories="false" />
<Directory path="$VSPath\Common7\IDE\PrivateAssemblies" includeSubDirectories="false" />
<Directory path="$VSPath\Common7\IDE\CommonExtensions\Microsoft\Editor" includeSubDirectories="false" />
<Directory path="$VSPath\Common7\IDE\CommonExtensions\Microsoft\TestWindow" includeSubDirectories="false" />
<Directory path="$VSPath\Common7\IDE\Extensions\Microsoft\Web Tools\Editors" includeSubDirectories="false" />
</DiscoveryResolution>
</AssemblyResolution>
</UnitTestRunConfig>
</TestTypeSpecific>
<AgentRule name="LocalMachineDefaultRole">
<DataCollectors>
<DataCollector uri="datacollector://microsoft/EventLog/1.0" assemblyQualifiedName="Microsoft.VisualStudio.TestTools.DataCollection.EventLog.EventLogDataCollector, Microsoft.VisualStudio.TestTools.DataCollection.EventLog, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" friendlyName="Event Log">
<Configuration>
<Setting name="EventLogs" value="Application, System" xmlns="" />
<Setting name="EntryTypes" value="Error, Warning" xmlns="" />
<Setting name="MaxEventLogEntriesToCollect" value="5000" xmlns="" />
<Setting name="CollectForInnerTests" value="False" xmlns="" />
</Configuration>
</DataCollector>
<!--<DataCollector uri="datacollector://microsoft/VideoRecorder/1.0" assemblyQualifiedName="Microsoft.VisualStudio.TestTools.DataCollection.VideoRecorder.VideoRecorderDataCollector, Microsoft.VisualStudio.TestTools.DataCollection.VideoRecorder, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" friendlyName="Screen and Voice Recorder">
<Configuration>
<MediaRecorder sendRecordedMediaForPassedTestCase="false" xmlns="" />
</Configuration>
</DataCollector>-->
</DataCollectors>
</AgentRule>
</Execution>
<Properties>
<Property name="VSApplication" value="VisualStudio"/>
<Property name="VSExecutable" value="$VSPath\Common7\IDE\devenv.exe"/>
<Property name="VSVersion" value="$VSVersion"/>
<Property name="VSHive" value=""/>
<Property name="VSDebugMixedMode" value="false"/>
<Property name="VSLaunchTimeoutInSeconds" value="120"/>
</Properties>
</TestSettings>