4

How do I find the location of the EDITBIN on a Microsoft-hosted agent? I'm trying to use it to set SWAPRUN for the output DLLs of a C# project.

For a local build, I use $(DevEnvDir)\..\..\VC\Tools\MSVC\14.14.26428\bin\Hostx86\x86\editbin. However, on the Microsoft-hosted agent, DevEnvDir is not defined, nor do I know if the rest of the path would work?

A related bonus question is where can I find in general the file structure for a Microsoft-hosted agent?

Edward Brey
  • 40,302
  • 20
  • 199
  • 253

2 Answers2

3

The editbin.exe exist in Hosted VS2017 agent in:

C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\SDK\ScopeCppSDK\VC\bin\editbin.exe

And to get the folder structure you can use a powershell script, such as:

cd "C:\Program Files (x86)\Microsoft Visual Studio\2017"
Get-childItem | tree

And if you want to check the structure of a root directory like C:\, it will cost a lot of time.

Marina Liu
  • 36,876
  • 5
  • 61
  • 74
0

For automated reasons one might select the correct variant of editbin automatically. I came up with the following PS script:

# define search parameters
$hostsys = "\hostx64"
$target = "\x86"
$basepath = "C:\Program Files (x86)\Microsoft Visual Studio\2019\"

# determine paths to the editbin executable and select the preferred one
$findings = Get-childItem -Path $basepath -Recurse -Include "editbin.exe"
$editbinexe = ""

Write-Host "`nEditbin candidates:"
foreach ($item in $findings) {
    [string]$directory = $item.DirectoryName.ToLower()
    Write-Host "$directory"
    
    if ($directory.Contains($hostsys) -and $directory.Contains($target))
    {
        $editbinexe = $item.FullName
    }
}

if ([string]::IsNullOrEmpty($editbinexe))
{
    Write-Host "`nEditbin was not found`n"
    exit -120
}

# execute the found executable

Write-Host "`nUsing editbin ""$editbinexe""`n"
Set-Location .\<the path to executable>
& $editbinexe /LARGEADDRESSAWARE "<the executable>"
tobster
  • 155
  • 1
  • 8