Plugin Csharp pour Xcode

Project Templates

The easiest way to set up the Xcode environment to handle C#/mono is to create a new project based on either the executable or the library project template. These templates are found in the "Project Templates" directory.

Xcode provides a hierarchical structure for the project templates: you've probably noticed the "New Project Assistant" lists top level entries such as 'Action', 'Application' and 'Bundle' with specific project templates listed underneath.

We will add an entry to this list named "C Sharp" with 'Executable' and 'Library' entries underneath it. As the names come form the directory names within the "Project Templates" directory, we can (in this situation) drag and drop the whole source directory into the target one.

Drag the source "Project Templates/C Sharp" directory into the "Project Templates" destination directory (see the waring above: this will replace any previous 'C Sharp' folder and its contents, but we want that in this case).

Target Templates

Within Xcode, Targets play a key role in determining how code files are handled, what products are built and which processes are used throughout.

As with the Project Templates, there are two 'flavours' of templates: one for creating an executable product and one for a library assembly. Targets can be added to any project, and the two Project Templates simply contain the appropriate target template as part of their definition.

The two target definition template files are distributed in the "Target Template" directory, inside a "C Sharp" folder. In a similar way to the Project Templates, when you add a new Target to a project, the 'New Target' assistant displays the templates in a hierarchical manner as determined by the directory structure. Therefore, having a 'C Sharp' folder means that the two templates will be conveniently located under a "C Sharp" top-level entry.

Drag the "Target Templates/C Sharp" source directory into the "Target Templates" destination directory. This will bring across the two ".trgttmpl" files.

File Template

So far we have installed the code that does all of the work in the background, the project templates for when we create a new project and the target templates for when we add a new template to an existing project. The last step is to install the template used when we want to add a new C# source file to a project.

The source directory "File Templates/C Sharp.pbfiletemplate" must be dragged to the destination directory "File Templates". Despite the fact that the directory has a file type, it really is just a directory. However the file type helps to tell Xcode that it should expect, not only a template of the new file, but a '.plist' file to tell it about the file.

ptain guigui la tu fais fort