- You had to manually save the files, and manually add them to Visual Studio.
- There were not any VB.NET snippets. (Jamie, please note there is no support in any of these technologies for F#)
- Lastly, the issue of versioning became an issue as I would refine some snippets.
The two main reasons I never made VB.NET snippets is A) they are pain to use in Visual Studio – it requires several mouse clicks; NOT COOL! Secondly, until today, I’ve NEVER been able to get a VB.NET snippet installed correctly.
Now, I am attempting to correct all that in one effort!
Enter the Division42.CodeSnippets VSIX extension:
I took a few minutes to create a .vsix package which will install both the C# and VB.NET snippets. As of this writing, the snippets included are:
- argNull – checks an argument for null (Nothing in VB), and throws an ArgumentException
- argString – checks a string argument for String.IsNullOrWhiteSpace(), and throws an ArgumentException
- propProper – creates a proper exception, and keeps the backing-field with the property. Also includes “Gets or sets …” XML code comments
- exceptionProper – a proper implementation of an Exception class, with basic XML code comments
The idea being that this is where this can start. As I develop other snippets (and I do use several other) – or if YOU have an idea for snippets, anyone can add them and we can publish a new version.
The project on GitHub:
I’ve made this open source on GitHub using a very liberal MIT license. I created the project with Visual Studio 2013 and do target .NET v4.5.2 (you might need to install the 4.5.2 Developer Pack). The project is out here:
If you are interested in contributing, see this page for information about how to contribute to an open source project on GitHub.
The VSIX on Visual Studio Gallery:
Once I verified that the installer worked locally, I published it out on Visual Studio Gallery, here:
You can also simply install it as a Visual Studio Extension from Tools –> Extensions and Updates, then search for “division42”:
There are a few more snippets I’ll work on and publish (for both C# and VB.NET), as time-permits. Meanwhile, if you have snippets you use and would like to contribute do a pull-request and let’s get them in here!