Skip to content

Instantly share code, notes, and snippets.

@codito
Created August 26, 2014 09:25
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codito/71748b015f61c17a85ef to your computer and use it in GitHub Desktop.
Save codito/71748b015f61c17a85ef to your computer and use it in GitHub Desktop.
Script to update assembly bindings to support 3rd party test adapters in Visual Studio Test Platform
#
# Script to update assembly bindings to support 3rd party test adapters in Visual Studio Test Platform
# Applies to VS 2014 CTP 3 bits
# Needs to run as Admin, please use it at your own risk
#
function Update-AssemblyBinding($configFile)
{
Write-Host "Updating $configFile"
[xml] $config = Get-Content $configFile
$config.configuration.runtime.assemblyBinding.dependentAssembly | % {
if ($_.assemblyIdentity.name.StartsWith("Microsoft.VisualStudio.Test"))
{
$_.bindingRedirect.oldVersion = "11.0.0.0-12.0.0.0"
}
}
$tempFile = [System.IO.Path]::GetTempFileName()
Write-Host "... Using temp file: $tempFile"
$backupFile = $configFile + ".orig"
Write-Host "... Backup $configFile -> $backupFile."
Copy-Item $configFile $backupFile
$config.Save($tempFile)
Copy-Item $tempFile $configFile
Write-Host "... Updated $tempFile -> $configFile."
}
if ($env:VS140COMNTOOLS -eq $null)
{
Write-Host "VS 2014 is not installed."
}
else
{
$testWindowPath = $env:VS140COMNTOOLS + "..\IDE\CommonExtensions\Microsoft\TestWindow\"
Push-Location $testWindowPath
Write-Host "Working directory: $testWindowPath"
Update-AssemblyBinding "vstest.console.exe.config"
Update-AssemblyBinding "vstest.discoveryengine.exe.config"
Update-AssemblyBinding "vstest.discoveryengine.x86.exe.config"
Update-AssemblyBinding "vstest.executionengine.clr20.exe.config"
Update-AssemblyBinding "vstest.executionengine.exe.config"
Update-AssemblyBinding "vstest.executionengine.x86.clr20.exe.config"
Update-AssemblyBinding "vstest.executionengine.x86.exe.config"
Pop-Location
}
@codito
Copy link
Author

codito commented Aug 26, 2014

Here's the manual workaround.

Modify assembly bindings for Microsoft.VisualStudio.Test* assemblies in the *.exe.config files in $env:VS140COMNTOOLS + "..\IDE\CommonExtensions\Microsoft\TestWindow"

Before

  <dependentAssembly>
    <assemblyIdentity name="Microsoft.VisualStudio.TestPlatform.ObjectModel" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
    <bindingRedirect oldVersion="12.0.0.0"  newVersion="14.0.0.0"/>
  </dependentAssembly>

After

  <dependentAssembly>
    <assemblyIdentity name="Microsoft.VisualStudio.TestPlatform.ObjectModel" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
    <bindingRedirect oldVersion="11.0.0.0-12.0.0.0"  newVersion="14.0.0.0"/>
  </dependentAssembly>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment