Visual studio 2017 Azure ARM DSC-安装VS2017远程调试器

Visual studio 2017 Azure ARM DSC-安装VS2017远程调试器,visual-studio-2017,remote-debugging,dsc,azure-automation,Visual Studio 2017,Remote Debugging,Dsc,Azure Automation,我正在为开发环境创建一个Service Fabric群集,该环境要求使用Powershell DSC在每个节点上安装Visual Studio 2017远程调试器并作为服务运行 我们的DSC脚本成功复制了vs2017 remote tools安装程序并进行无人值守安装,但我们正在努力使其作为服务运行,并使用正确的防火墙设置。以下是我们的最终结果: # Download and configure Chocolaty cChocoInstaller InstallChoco { Ins

我正在为开发环境创建一个Service Fabric群集,该环境要求使用Powershell DSC在每个节点上安装Visual Studio 2017远程调试器并作为服务运行


我们的DSC脚本成功复制了vs2017 remote tools安装程序并进行无人值守安装,但我们正在努力使其作为服务运行,并使用正确的防火墙设置。

以下是我们的最终结果:

# Download and configure Chocolaty
cChocoInstaller InstallChoco 
{ 
    InstallDir = "C:\choco" 
}

# Download and install VS2017 Remote Debugger
cChocoPackageInstaller InstallRemoteDebugger
{            
    Name = "visualstudio2017-remotetools" 
    Version = "15.0.26430.2" 
    Source = “https://github.com/chocolatey/chocolatey-coreteampackages/tree/master/manual/visualstudio2017-remotetools” 
    DependsOn = "[cChocoInstaller]installChoco"
}

# Install the remote debugger and run as a service
Script ConfigureRemoteDebugger {
    GetScript  = { @{ Result = "" } }
    TestScript = { 

        $msvsmonPathx64 = 'C:\Program Files\Microsoft Visual Studio 15.0\Common7\IDE\Remote Debugger\x64\msvsmon.exe'
        $serviceName = "msvsmon150"
        $result = $true

        # Validate the VS2017 Remote Debugger is installed to the harddrive
        $result = $result -and (Test-Path $msvsmonPathx64)

        # Verify the service exists and is running
        if ($service = Get-Service -Name $serviceName -ErrorAction SilentlyContinue) {
            if ($service.Status -eq "Running") {
                $result = $result -and $true
            }
            else {
                $result = $result -and $false
            }
        }
        else {
            $result = $result -and $false
        }

        return $result
    }
    SetScript  = 
    {
        # Run as service
        $startDebugger = $true
        $remoteDebugExe = "`"C:\Program Files\Microsoft Visual Studio 15.0\Common7\IDE\Remote Debugger\x64\rdbgservice.exe`" msvsmon150"
        $serviceName = "msvsmon150"
        $serviceDisplayName = "Visual Studio 2017 Remote Debugger"
        $serviceDescription = "Allows members of the Administrators group to remotely debug server applications using Visual Studio. Use the Visual Studio Remote Debugging Configuration Wizard to enable this service."

        if (!(Get-Service -Name msvsmon150 -ErrorAction SilentlyContinue)) {
            New-Service -Name $serviceName -BinaryPathName $remoteDebugExe -DisplayName $serviceDisplayName -Description $serviceDescription 
        }

        if ($startDebugger -eq $false) {
            Set-Service -Name $serviceName -StartupType Manual
        }
        else {
            Set-Service -Name $serviceName -StartupType Automatic
            Start-Service -Name $serviceName
        }
    }
    Credential = $serviceAccountCredential
    DependsOn  = "[cChocoPackageInstaller]InstallRemoteDebugger"
}
注意:您的DSC可能需要配置防火墙以允许远程调试器,否则您将无法连接

下载+安装过程如此简单,这是一个巨大的口号