Search code examples
svnvisual-studio-2013version-controlcode-snippets

What is a good way to share snippets specific to a project in a dev team using SVN and VS2013?


I am working on a web app project in ASP.NET 4.5.2 / MVC 5 inside a team of 5 people including me. The solution is version controlled with SVN.

We are all using Visual Studio 2013.

I have wrote custom code snippets, highly relative to the project contents (not just the average easy try/catch) to help other devs get started on what I do (they are working on the parts of the app that are in WebForms still) as well as help everyone make less errors on those repetitive/specific code blocks. These snippets are for C# (for the Controllers usually) as well as for JavaScript (jQuery), and maybe I'll write some for other languages as I go.

I am willing to provide the other devs with a simple method to get those snippets, maybe edit them (so I'll need the snippet files to be version controlled), and keep them up-to-date easily, without having to copy/paste or re-import the files continuously into their dev environment.

I think I need a way to either:

  • Add the snippets into the solution itself as snippets (not as plain versionned files), have them versionned with it directly and have VS load them automatically
  • Add the snippets to some (other?) repository, and have visual studio load them from that repository (and make sure the repo is up-to-date?)
  • Something else?

What is a good practice concerning this? Should I do it completely differently?


Solution

  • I found ReSharper (from JetBrains) allows to have a shared object file containing templates settings and data, allowing you to commit that to the SVN repository along with the solution. The other devs are able to simply update their local working dir and ReSharper updates its templates automatically.

    See this page on ReSharper templates sharing for instance