locked
Add custom file templates RRS feed

  • Question

  • User164593 posted

    Hi,

    I've been using Xamarin Studio for about 4 months now and I've been bothered by this.

    Where can I create a template file ? I often want to add a new file, and I'm forced to use the default "Empty class" file, for example, where I would like to add very specific file instead.

    More specifically, for the sake of giving an example, I'll often create unit-tests classes that inherit from a project specific baseclass. Right now, I can not :

    • Create a default unit-test class from the new file option.
    • Create a custom file from the new file option, based on a "currently opened file" or "file from disk", for example.
    • Save that template as a new template for that solution, or even forever in XamarinStudio.
    • Manage/Move/Remove/Edit folders and template files given in the currently default list of "Add New File".

    My questions are :

    Is this already available, if so, where? If not, is it already in your pipeline of future features?

    This would be really great as, typically, we create about 150 test classes that have the exact same starting layout (test fixture, setup, teardown, and so on).

    Having the test class in the template would be a plus, behing able to add stuff myself would be best, as most developers will probably use those classes differently.

    Tuesday, October 6, 2015 12:47 PM

Answers

  • User18049 posted

    File templates need to be registered with Xamarin Studio. This is done by the addin in its addin.xml file.

    Out of the box you can add custom code snippets in Preferences. You might be able to use those, not sure if these are a good fit for you or not.

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Tuesday, October 6, 2015 6:07 PM

All replies

  • User18049 posted

    File templates need to be registered with Xamarin Studio. This is done by the addin in its addin.xml file.

    Out of the box you can add custom code snippets in Preferences. You might be able to use those, not sure if these are a good fit for you or not.

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Tuesday, October 6, 2015 6:07 PM
  • User164593 posted

    Okay thanks. I did not think of browsing through the files of the Xamarin Studio package but now I've found plenty of .xml files I can fiddle around with :)

    Though that would be nice to have an IDE feature allowing this, maybe simply by adding an "Edit template" button that loads the specific .xml

    Wednesday, October 7, 2015 8:01 AM