= Introduction = Let's say your company name is !MyCompany and your project is called !MyProject. You want to put most of your code for the project in a library, with a small console program to provide a command line interface to it. Here are the steps. = Create a New Solution with Library Project = * Launch Xamarin Studio 4.2.3 * File > New > Solution * Choose Cobra > Console Project * Give a name like "!MyCompany.!MyProject.Lib" in the "Name:" field * Edit the "Solution name:" field to chop off the ".Lib" to make it "!MyCompany.!MyProject" * Leave "Create directory for solution" checked. * Click "OK" * Edit the class: {{{ #!cobra class Thing test pass get two as int return 2 }}} = Create Console Project = * In the solution outline, the very top node says "!MyCompany.!MyProject" * Right click it and choose Add > Add New Project * Choose Cobra > Console Project * Give a name like "!MyCompany.!MyProject.Console" in the "Name:" field. * Right click in the new project in the solution outline and choose "Set As Startup Project" * Open Program.cobra in the solution outline and add "Console.readLine": {{{ #!cobra """ Replace this text with a description of your program. """ class Program def main print 'Hello, world!' Console.readLine # <--- add this }}} = Copy the Core = I like to copy Cobra's core library to co-reside with my program. This insulates it from the environment. * Right click "!MyCompany.!MyProject.Console" and choose "Options" * Choose "Compiler" * Make sure "Embed Run Time" is unchecked * Add "-copy-core" to the "Cobra Arguments:" * Click "OK" = Run It = Try running the project. * Choose from the menu, Run > Start Without Debugging * If you get an error about System.Core, expand the References of the Console project in the solution outline, right click and choose "Delete". You should see output like: {{{ Hello, world! trace : t.two=2 - at Program.cobra:14 - in Program.main }}} Press "Return" to continue. = Build Files = In the file system, under the directory MyCompany.MyProject\MyCompany.MyProject.Console\bin\Debug you will now have these files: Cobra.Core.dll MyCompany.MyProject.Console.exe MyCompany.MyProject.Console.pdb MyCompany.MyProject.Lib.dll MyCompany.MyProject.Lib.pdb = Where to go from here = * You can now start fleshing out your library. * You can use that library from the console program. * You can later use that library in a web site, web service or GUI app. * Explore the right click menus in Xamarin Studio. * Try out some breakpoint debugging. * If you get stuck or experience bugs, get on the Cobra discussion forums. * If you see errors on this page, or you have additional tips, edit this page. That's the "wiki way".