使用代理

编辑

C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\devnet.exe.config

{system.net}闭包内添加行:

<defaultProxy useDefaultCredentials="true" enabled="true">
    <proxy bypassonlocal="true" proxyaddress="http://127.0.0.1:1080" />
</defaultProxy>

C#/Native混合调试

如果调用Native方法,可以开启 Enable unmanaged code debugging 进行调试,可以方便查看出C++代码的错误。(位于C#项目属性->Debug->Enable unmanaged code debugging)

win32 窗口程序同时调出控制台窗口

设置方式
项目 -> 属性 -> 生成事件 ->后期生成事件 -> 命令行 中添加

editbin /SUBSYSTEM:CONSOLE $(OutDir)\$(ProjectName).exe
  <Target Name="PostBuild" AfterTargets="PostBuildEvent" Condition="'$(Configuration)' == 'Debug'">
    <Exec Command="editbin /SUBSYSTEM:CONSOLE &quot;$(OutDir)$(ProjectName).exe&quot;" />
  </Target>

如果项目为 CMAKE项目工程,可以使用以下POST_BUILD事件进行处理:

# for showing the command line to debug in convenience.
add_custom_command(
    TARGET ${PROJECT_NAME} POST_BUILD
    COMMAND editbin /SUBSYSTEM:CONSOLE $<TARGET_FILE:${PROJECT_NAME}>
)
editbin 目录参考(需要加进PATH环境变量)
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\bin\Hostx64\x64
最后修改:2025 年 06 月 16 日
如果觉得我的文章对你有用,请随意赞赏