visual_studio.rst 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. .. _doc_configuring_an_ide_vs:
  2. Visual Studio
  3. =============
  4. `Visual Studio Community <https://visualstudio.microsoft.com>`__ is a Windows-only IDE
  5. by `Microsoft <https://microsoft.com>`_ that's free for non-commercial use.
  6. It has many useful features, such as memory view, performance view, source
  7. control and more.
  8. Importing the project
  9. ---------------------
  10. Visual Studio requires a solution file to work on a project. While Godot does not come
  11. with the solution file, it can be generated using SCons.
  12. - Navigate to the Godot root folder and open a Command Prompt or PowerShell window.
  13. - Run ``scons platform=windows vsproj=yes`` to generate the solution.
  14. - You can now open the project by double-clicking on the ``godot.sln`` in the project root
  15. or by using the **Open a project or solution** option inside of the Visual Studio.
  16. - Use the **Build** top menu to build the project.
  17. .. warning:: Visual Studio must be configured with the C++ package. It can be selected
  18. in the installer:
  19. .. figure:: img/vs_1_install_cpp_package.png
  20. :align: center
  21. Debugging the project
  22. ---------------------
  23. Visual Studio features a powerful debugger. This allows the user to examine Godot's
  24. source code, stop at specific points in the code, inspect the current execution context,
  25. and make live changes to the codebase.
  26. You can launch the project with the debugger attached using the **Debug > Start Debugging**
  27. option from the top menu. However, unless you want to debug the project manager specifically,
  28. you'd need to configure debugging options first. This is due to the fact that when the Godot
  29. project manager opens a project, the initial process is terminated and the debugger gets detached.
  30. - To configure the launch options to use with the debugger use **Project > Properties**
  31. from the top menu:
  32. .. figure:: img/vs_2_project_properties.png
  33. :align: center
  34. - Open the **Debugging** section and under **Command Arguments** add two new arguments:
  35. the ``-e`` flag opens the editor instead of the project manager, and the ``--path`` argument
  36. tells the executable to open the specified project (must be provided as an *absolute* path
  37. to the project root, not the ``project.godot`` file).
  38. .. figure:: img/vs_3_debug_command_line.png
  39. :align: center
  40. To learn more about command line arguments, refer to the
  41. :ref:`command line tutorial <doc_command_line_tutorial>`.
  42. Even if you start the project without a debugger attached it can still be connected to the running
  43. process using **Debug > Attach to Process...** menu.
  44. To check that everything is working, put a breakpoint in ``main.cpp`` and press :kbd:`F5` to
  45. start debugging.
  46. .. figure:: img/vs_4_debugging_main.png
  47. :align: center
  48. If you run into any issues, ask for help in one of
  49. `Godot's community channels <https://godotengine.org/community>`__.