通过cmd配置VS远程调试器的方法

时间:2014-07-30 09:09:06

标签: remote-debugging

我想自动将Visual Studio Remote Debugger部署到目标计算机。我可以通过cmd,grant required prevelegues to usermodify firewall以静默方式安装Remote Debugger。我必须使用Wizard(rdbgwiz.exe)配置它,似乎Wizard没有命令行参数。我如何配置Remote Debugger?没有Wizard有没有办法做到这一点? Wizard的作用是什么?只是创建服务?

2 个答案:

答案 0 :(得分:4)

运行Wizard不是必需的。您可以执行以下操作:
1)完全禁用Windows防火墙。不幸的是,部分修复因为允许所需端口的连接不起作用 2)安装调试器,使用 / q 选项进行静默安装
3)允许您的帐户Log on as a Service 4)更改远程调试器服务的登录凭据 5)启用调试器服务 6)运行它。 *
所以,我的bat文件看起来像

@echo off

pushd %~dp0

netsh advfirewall set domain state off
netsh advfirewall set private state off
netsh advfirewall set public state off

if "%PROCESSOR_ARCHITECTURE%"=="x86" (
  set arch=x86
) else (
  set arch=x64
)

"rtools_setup_%arch%.exe" /q

ntrights.exe -u %username% +r SeServiceLogonRight

sc config msvsmon120  obj= "%computername%\%username%" password= "password"
sc config msvsmon120 start= auto
sc start msvsmon120

*)注意调试器版本。不同版本的调试器具有不同的服务名称:msvsmon100适用于VS 2010调试器,msvsmon110适用于2012,msvsmon120适用于2013.

答案 1 :(得分:0)

我正在使用此脚本在我的虚拟开发环境中使用VirtualBox,Vagrant,Chocolatey和PowerShell安装VS 2013远程工具。如果你不使用所有这些工具,你可以选择你喜欢的位。

Import-Module "$env:ChocolateyInstall\helpers\chocolateyInstaller.psm1"

# use different name for different versions
$VSMonitor = "msvsmon120"

Write-Host "Disabling firewall on host."
Set-NetFirewallProfile -Profile * -Enabled False

if ((get-service | Where-Object { $_.Name -eq $VSMonitor}) -eq $null) {

    # The shared /vagrant folder is not always properly mounted by Vagrant\Virtualbox or is still in the 
    # process doing so. To circumvent this we apply a net use on the shared /vagrant folder. This will make the 
    # c:\vagrant folder and the iso folder is accessible.   
    If(Test-Path "x:") {
        Write-Host "Removing network drive x:"
        net use x: /delete
    }

    Write-Host "Applying fix for shared c:\vagrant folder mounting problem by doing a net use x: on \\vboxsvr\vagrant"
    net use x: \\vboxsvr\vagrant

    Write-Host "Installing Visual Studio 2013 Remote Tools as it is not already installed."

    $installer = "c:\vagrant\iso\vs2013_with_update_4_rtools_setup_x64.exe"       
    $installerArgs = "/install /quiet"

    Start-ChocolateyProcessAsAdmin -statements $installerArgs -exeToRun $installer -Wait

    Set-Service -Name $VSMonitor -StartupType "Automatic"

    Start-Service -Name $VSMonitor
} else {
    Write-Host "Not installing Visual Studio 2013 Remote Tools as it is already installed."
}