VC2013 遠程調試
或者從安裝過VS2013的電腦上覆制Program Files(x86)\Mircrosofe Visual Studio 12.0\Common7\IDE\Remote Debugger也行
2:在遠端電腦上安裝remote tools,開始菜單裏面多出Visual Studio 2013
Remote Debugger Configuration Wizard是設置嚮導,但是經過測試,不要使用這個嚮導。
關於嚮導(可以直接跳過灰色字體)
這個嚮導把遠端調試器設置爲windows服務(安裝了兩個服務,名稱爲Remote Debugger,Visual Studio ETW Event Collection Service,而VS2008安裝的對應服務名稱爲Visual Studio 2008 Remote Debugger),完成開機自啓動,會遇到以下問題:
- 開機啓動後,遠程調試時Local端彈出錯誤,大意爲服務無法和UI交互
- 遠端調試器默認需要Windows Authentication,無法設置爲No Authentication,調試時需要輸入遠端的windows 登陸名和密碼,比較麻煩
我採用在開始菜單--啓動裏面創建對應的快捷方式,來完成自啓動功能,快捷方式參數如下
"C:\Program Files\Microsoft Visual Studio 12.0\Common7\IDE\Remote Debugger\x86\msvsmon.exe" /nostatus /timeout:9999999 /noauth /anyuser /noclrwarn /nosecuritywarn
其中
Deploy Visual C++ Debug Runtime 項要選擇Yes,VS會自動複製mfc120ud.dll等dll到遠端位置,否則運行遠端軟件,會提示The Program can't start because mfc120ud.dll is missing from your computer,Try reinstalling
the program to fix this problem
關於遠端電腦直接運行Debug版本的程序(可以直接跳過灰色字體)
如果編譯Debug版本,放到未安裝VS2013的電腦上,直接運行exe,會提示“The Program can't start because mfc120ud.dll is missing from your computer,Try reinstalling the program to fix this problem”。
解決方法:
從C:\program files\Microsoft Visual Studio 12.0\VC\redist\Debug_NonRedist 複製對應的dll到exe同目錄下,主要不要直接複製子文件,而是把所有子文件夾下的dll複製出來放到exe同目錄
Additional Files to Deploy 可以複製其他文件到遠端
當文件非常多,或者文件分了多個子文件夾時,再使用Additional Files to Deploy
就非常麻煩了,這時可以通過Build Event--Post-Build Event添加複製命令,把指定文件夾全部文件複製到遠端
if "$(DebuggerFlavor)" equ "WindowsRemoteDebugger" (goto RemoteMode) else (goto LocalMode)
goto End
:RemoteMode
echo "..\..\bin\$(Platform)\$(Configuration)
\\$(RemoteDebuggerServerName)\zd\ZDTerminal\ /E /Y /F /I"
xcopy ..\..\bin\$(Platform)\$(Configuration)
\\$(RemoteDebuggerServerName)\zd\ZDTerminal\ /E /Y /F /I /D /EXCLUDE:..\..\resource\uncopy.txt
goto End
:LocalMode
echo "not copy to $(RemoteDebuggerServerName)\zd\ZDTerminal"
:End
其中$(RemoteDebuggerServerName) 即爲上圖中的Remote Server Name ,他可以直接填寫ip地址,zd是該ip電腦上的共享文件夾名稱
上面的命令可以自動識別Remote Windows Debugger 和Local Windows Debugger,當選擇Local時不再複製文件到遠端