Jump to content

How do i export c# addon to a dll file?


danger cow

Recommended Posts

so im trying to follow the addon tutorial on the ksp wiki and wrote this
 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BodyNamer
{
    class HelloKerbin : PartModule
    {
        public static void Main()
        {

        }

        public override void OnStart(StartState state)
        {
            print("hello, kerbin");
        }
    }
}

then it asked me to export it to a dll without telling me how so i just built the solution and all that came out was a exe
how can i export it to a dll?

Link to comment
Share on other sites

When you create a new project in Visual Studio, you can choose between a class library or some type of app. To create a .dll (a Dynamic Link Library), you need to choose a class library ;)

You can change this afterwards in the project properties: Hit 'Project' in the menu bar -> your_project_name Properties and switch the output type to class library:

8k3JZb2.png

Also, be sure that the target framework is set to version 3.5 ;)

Link to comment
Share on other sites

thanks :)

1 hour ago, 4x4cheesecake said:

When you create a new project in Visual Studio, you can choose between a class library or some type of app. To create a .dll (a Dynamic Link Library), you need to choose a class library ;)

You can change this afterwards in the project properties: Hit 'Project' in the menu bar -> your_project_name Properties and switch the output type to class library:

8k3JZb2.png

Also, be sure that the target framework is set to version 3.5 ;)

one last thing how would i create a mono behavior script that starts when the game starts?

Edited by danger cow
Link to comment
Share on other sites

6 minutes ago, danger cow said:

one last thing how would i create a mono behavior script that starts when the game starts?

This would be pretty much the very first example of the tutorial of Diazo about this topic:

I guess, you can change

[KSPAddon(KSPAddon.Startup.MainMenu, false)]

to

[KSPAddon(KSPAddon.Startup.Instantly, false)]

if you really want to start the plugin as fast as possible.

Link to comment
Share on other sites

1 minute ago, 4x4cheesecake said:

This would be pretty much the very first example of the tutorial of Diazo about this topic:

I guess, you can change


[KSPAddon(KSPAddon.Startup.MainMenu, false)]

to


[KSPAddon(KSPAddon.Startup.Instantly, false)]

if you really want to start the plugin as fast as possible.

thanks

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