Setting up Visual Studio
Microsoft Visual Studio is a program (more specifically IDE, or Integrated Development Environment) that makes it easier to code applications for Windows. For KSP, it is used for developing plugins (parts, part modules, mono behaviours or scenario modules) via the C# IDE, although any program that can compile C# is sufficient.
In order to complete this tutorial you must have the following. Plugins may be written in other environments.
- Microsoft Windows XP or above
- Microsoft .NET Framework 3.5 or above
- For Windows 7 or 8 Visual Studio Community 2015 or for Windows XP Microsoft Visual C# Express 2010
- You can also use Visual Studio 2012 or 2013 or 2015 (2010 for XP), which is functionally similar.
- Latest version of Kerbal Space Program.
- Close any solutions you currently have open by choosing File > Close Solution.
- Start a new solution either by selecting New Project from the Home screen, or by using File > New > Project...
- Create a new Class Library project for C#: In the "New Project" dialog, on the left choose Installed > Templates > Visual C# > Windows. In the middle, choose Class Library. At the top, if your version of Visual Studio has a dropdown for .NET version, choose .NET Framework 3.5.
- Name it whatever you like. (We're using MyKSPProject for this tutorial, so replace MyKSPProject with whatever you're using.)
- In your Solution Explorer (the pane on the top right of the screen), right-click on MyKSPProject (not "Solution 'MyKSPProject' (1 project)") and choose Add Reference.
- Switch to the Browse tab.
- Click on the "Browse..." button.
- Go to your KSP_Data\Managed folder and add the following DLLs as references:
- Save your solution.
- If you didn't set the .NET Framework earlier, in your Solution Explorer (the pane on the top right of the screen), right-click on MyKSPProject and choose Properties. Change the Target Framework to 3.5 (Visual Studio will default to a newer framework version). Visual Studio will reload the project after you click ok.
Great, you're all set! Now continue to creating your first module!