如何确保每次我从命令提示符加载 Visual Studio 以使用 -debugexe 命令进行调试时,它都会加载所有源代码?
How to make sure that every time I load Visual Studio from a command prompt for debugging with -debugexe command it loads all the source code?
我正在通过命令提示符编译我的代码,我经常需要快速调试一些东西,我使用 devenv -debugexe x.exe
从 cmd 启动 Visual Studio 但它不会加载源代码,这很烦人每次我重新编译我的代码时手动进行。也许 Visual Studio 中有一个设置只启动一次并重新加载所有新编译的代码?或者附加到可执行文件一次,这样我就可以随时 运行 它?每次都附加到一个进程也很烦人。
How to make sure that every time I load Visual Studio from a command
prompt for debugging with -debugexe command it loads all the source
code?
devenv -debugexe x.exe
相当于通过Attach to process调试程序。
和 devenv -debugexe x.exe
本身就是一个调试项目的快捷机制(attach to process),所以它不会同时重建您的项目。
它没有在调试之前加载源代码和构建项目的工作。
Perhaps there is a setup in Visual Studio to just launch it once and
reload all freshly compiled code? Or to attach to a executable once,
so I could run it anytime?
据我所知,当你附加到进程时,没有这样的选项来重建你的项目。
建议
因此,为了实现您的目标,您应该在使用 devenv -debugexe x.exe
之前使用 MSBuild 命令行构建您的项目。
打开 Developer Command Prompt for VS 然后输入:
cd xxxxx(the folder which the `xxx.sln` exists)
msbuild xxx.sln -t:Build
然后您可以使用devenv -debugexe x.exe
调试包含新更改的程序。
Besdies,如果你想查看源代码并在上面调试,你可以右击在Solution Explorer-->Debug-->Step into New Instance即可调试源码。
有了以上所有这些,您就可以在路上获得所有新的源代码。
我正在通过命令提示符编译我的代码,我经常需要快速调试一些东西,我使用 devenv -debugexe x.exe
从 cmd 启动 Visual Studio 但它不会加载源代码,这很烦人每次我重新编译我的代码时手动进行。也许 Visual Studio 中有一个设置只启动一次并重新加载所有新编译的代码?或者附加到可执行文件一次,这样我就可以随时 运行 它?每次都附加到一个进程也很烦人。
How to make sure that every time I load Visual Studio from a command prompt for debugging with -debugexe command it loads all the source code?
devenv -debugexe x.exe
相当于通过Attach to process调试程序。
和 devenv -debugexe x.exe
本身就是一个调试项目的快捷机制(attach to process),所以它不会同时重建您的项目。
它没有在调试之前加载源代码和构建项目的工作。
Perhaps there is a setup in Visual Studio to just launch it once and reload all freshly compiled code? Or to attach to a executable once, so I could run it anytime?
据我所知,当你附加到进程时,没有这样的选项来重建你的项目。
建议
因此,为了实现您的目标,您应该在使用 devenv -debugexe x.exe
之前使用 MSBuild 命令行构建您的项目。
打开 Developer Command Prompt for VS 然后输入:
cd xxxxx(the folder which the `xxx.sln` exists)
msbuild xxx.sln -t:Build
然后您可以使用devenv -debugexe x.exe
调试包含新更改的程序。
Besdies,如果你想查看源代码并在上面调试,你可以右击在Solution Explorer-->Debug-->Step into New Instance即可调试源码。
有了以上所有这些,您就可以在路上获得所有新的源代码。