Back in Visual Studio 2005, Microsoft introduced reusable code snippets that can be picked up in the code editor with IntelliSense support. Something like this:
Code Snippets are XML files with .snippet extension based on a specific schema. Rather than typing manually your XML files, a good idea is using a snippet editor. There are a lot of snippet editors available for free, I personally use the Snippet Designer editor which is integrated in the IDE. With an editor like this, you simply write or copy-paste code and provide the appropriate metadata information. The editor is responsible for producing well-formed XML files that can be correctly recognized by Visual Studio.
I will not cover creating code snippets here, I will instead show how to package snippets for easy deployment.
Once you have your snippets, you might want to use them in the code editor or to share them with other developers. Code snippets are stored inside language-specific folders, such as C:\Program Files (x86)\Microsoft Visual Studio 11.0\VB\Snippets\1033. Also, Visual Studio provides the My Code Snippets folders where users can save snippets without being administrators.
In the previous editions of Visual Studio, you could package a number of snippet files (plus add-ins, macros, item/project templates, controls) inside a .Vsi installer. Then, the Visual Studio Content Installer tool helped users install contents into the appropriate location.
Even though .Vsi packages are still supported, Visual Studio 2012's extensibility relies on the VSIX file format, which provides a better customer experience. For this reason, sharing reusable code snippets should be done with a VSIX package.
Assuming you have a number of snippets ready and that you already installed the Visual Studio 2012 SDK, the first thing you need to do is creating a new, empty VSIX project:
In Solution Explorer, add a new folder to the project where you will store snippets. The name of the folder is very important, because it will be also the name of the group of snippets inside the code editor. Add all the .snippet files you want to deploy to other developers:
As you can see in the figure, it is very important to remember to set the Build Action, Copy to Output Directory, and Include in VSIX properties as shown, otherwise snippets will not be included in the package.
The next step is adding a package definition file, with .pkgdef extension. To add one, you can simply use the text file template. The package definition file will tell the installer where to install code snippets. I am using Visual Basic code snippets, so I'm going to use the following syntax:
Don't forget to set the file properties as you already did for snippets. The next step is making a manual edit to the extension manifest. In Solution Explorer, right click the source.extension.vsixmanifest file and choose to open it with the XML internal editor, finally add the following node before the closing file tag:
<Asset Type="Microsoft.VisualStudio.VsPackage" Path="Snippets\DelSoleVBSnippets.pkgdef" />
Close the XML editor and re-open the manifest with its designer. Set the extension's metadata (publisher, license, images) but make sure you do not change the asset added manually. You are done.
You can now debug your extension in the experimental instance of Visual Studio by simply pressing F5. When ready, switch to the Release configuration and build the solution. You will find the redistributable .Vsix package under Bin\Release as usual. This package can be easily published to the Visual Studio Gallery for easy deployment through the Extension Manager in Visual Studio.
Note: if you plan to install your snippets to a non-default location, you might need to create a snippet index file. Check out this page in the MSDN documentation.
Enjoy your code snippets!
You might need to analyze RSS feeds from different pages in order to get information and latest news from a channel. Facebook and Twitter are probably the most interesting, but there's no easy specific API.
Fortunately it is possible to retrieve the RSS feed 2.0, that is XML, in a pretty easy way. The following URL allows retrieving the RSS feed of a Facebook page (not user profile):
Where pageidnumber is the id of the desired page. For instance, the Facebook address for my VB community in Italy is the following:
About Twitter, you can retrieve a feed like this:
Where username is the account name of the person you are following. For instance, this is the RSS feed for the profile of my Italian VB community:
You might find this useful