Jump to content

Compiling a ksp plugin from sourcecode


Recommended Posts

I'm a novice Java programmer and I was trying to see if I could figure out C# enough to make a simple tweak to how a plugin operated. I downloaded the source code and tried to compile the .cs to a .dll from the command prompt

I'm using this syntax on the command line.

csc /target:library /out:C:\...path...\Output.DLL C:\...path...\Input.cs

I get a lot of errors saying Namespace name 'KSP' could not be found, 'UnityEngine' could not be found, etc., , which I take to mean I have to tell the compiler to use other KSP and Unity resources.

Is this a simple fix or am I making things needlessly complex by bypassing an IDE?

Thanks all!

 

Link to comment
Share on other sites

16 hours ago, Epiphoskei said:

making things needlessly complex by bypassing an IDE?

Hi. i think the quote applies, even a dummy such as I  can compile C# for KSP using VS, why do it the hard way.  Yes the assets references required are all contained in KSP_x64_Data, and using an IDE it's a very simple matter to link /add the ref you require . There are several guides for the how to of plugins for KSP to be found in the addon development section and it's sub sections

Edited by SpannerMonkey(smce)
Link to comment
Share on other sites

16 hours ago, Epiphoskei said:

csc /target:library /out:C:\...path...\Output.DLL C:\...path...\Input.cs

Is this a simple fix or am I making things needlessly complex by bypassing an IDE?

Try msbuild or xbuild instead (depending on your OS). Plugin source code will include a csproj file and sometimes an sln, which tells those tools how to compile it.

(You'll still get errors unless you edit the csproj file to tell the compiler where to find KSP, of course. Search for DLLs and you should see the paths the mod author used.)

Link to comment
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.

Guest
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.

×
×
  • Create New...