0

I am trying to get started with Cosmos using C#. I installed Visual studio 2017, and Cosmos user kit. On many tutorials on youtube, I have seen that the VMWare player starts whenever they press the "run" button.

However, in my case, I get the following error: "A project with an Output type of class library cannot be started directly."

Error screenshot

My code is really simple, and it is the basic example given in the documentation. Please help me to solve this issue.

using System;
using System.Collections.Generic;
using System.Text;
using Sys = Cosmos.System;

namespace CosmosKernel2
{
    public class Kernel : Sys.Kernel
    {
        protected override void BeforeRun()
        {
            Console.WriteLine("Cosmos booted successfully. Type a line of text to get it echoed back.");
        }

        protected override void Run()
        {
            Console.Write("Input: ");
            var input = Console.ReadLine();
            Console.Write("Text typed: ");
            Console.WriteLine(input);
        }
    }
}
DilupaH
  • 11
  • 3
  • Possible duplicate of ["A project with an Output type of Class Library cannot be started directly"](https://stackoverflow.com/questions/3363106/a-project-with-an-output-type-of-class-library-cannot-be-started-directly) – Guy Oct 17 '18 at 11:44

1 Answers1

2

Cosmos is a kernel. You can't "run a kernel on windows". If you want to run your cosmos kernel straight out of Visual Studio you need a virtual machine.

Cosmos uses Vmware out of the box. Make sure you have it installed. Alternatively you can use VirtualBox, I personally got it to run on that too.

You can also run it on an actual machine with a bootloader, like Grub. You can dual boot into windows or your own kernel that way.

Cosmos has instructions here: https://github.com/CosmosOS/Cosmos/wiki/Deployment

Set the boot that cosmos generates as startup project to run it.

fstam
  • 669
  • 4
  • 20
  • Hello, I have VMware player installed. In all the tutorials, when they click on the "run" button, VMWare pops up automatically. The problem is, this doesn't happen in my PC. I couldn't figure out a reason for that. – DilupaH Oct 18 '18 at 06:11
  • When you create a new Cosmos project with the visual studio template, it should generate a solution with 2 projects. and boot. You need to set boot as startup project by right-clicking it. – fstam Oct 18 '18 at 09:53