How to set up Visual Studio to compile addons?

Recommended Posts

I tried following this tutorial on the wiki, but there are no templates for C# in the copy of Visual studio I have, so I can't directly follow the tutorial. It seems there's a marketplace full of alternative templates, but I have no idea what they do, what they are for, and if they'll work for KSP. I can't seem to figure out how to compile anything when I mess about by myself, either. How should I go about setting it up so I can build my first hello world addon?


EDIT: I just realized this may be in the wrong section. Feel free to move it if necessary.

Edited by Pacca

Share this post

Link to post
Share on other sites
5 hours ago, Pacca said:

the copy of Visual studio I have,

And which version do you use? I assume it is Visual Studio 2017 Community Edition since it is the latest non-paid-stable version available.

In general, Visual Studio (VS) will not install everything, you have to choose the packages you want. To do this, launch the VS installer, for example by starting VS and in the menu bar, click on 'Tools' -> 'Get Tools and Features':


(Sorry in advance for the german UI in the following screenshots....for some reasons the installer doesn't change the language, even when VS runs with a english language pack. I'll try to translate everything for you ;) )

This will bring up the installer, which comes with 4 tabs. Most important for you should be 'Workloads' and 'Single Packages':


In the 'Workloads' tab, you can choose from different, pre-defined packages. I would suggest to pick '.NET-Desktopdevelopment' (the very first one in the list) and 'Universal Windows-Plattform Development'.
If you scroll down in the list, you can also find 'Gamedevelopment for Unity' which may become interesting for you in the future.

Switch to the 'Single Components' tab and be sure, that the '.NET Framework 3.5 Development tools' are selected as well, it is right at the top of the list:


(Mods for KSP need to be compiled for .NET 3.5 so you will definitly need this one)

As soon as everything is selected, you can hit 'Apply' and VS will install all the packages for you (this might  take same time).

After everything is done, you can switch back to VS (maybe restart it if the installer doesn't do this for you anyway), and create a new project. In the next window, you should be able to navigate to 'Installed -> Other Languages -> Visual C# -> Class Library (.NET Framework)', select '.NET Framework 3.5' as the framework at the bottom, click 'OK' and you are ready to go to write some sweet plugins :)


If you haven't read it already, you might be interested in this thread as well:


Share this post

Link to post
Share on other sites

If you're going to be debugging plugins this link explains how to attach VS to Unity - allows you to step through your code, set break points, change variables on the fly - it spoiled me and I refuse to go back to log message debugging.



Share this post

Link to post
Share on other sites
This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.