Custom NuGet Source for MSBuild

NuGet-Logo-2If you have a custom data source for your NuGet packages and you use MSBuild for your solutions, MSBuild will not be able to restore these packages.

To achieve this without adding specific configuration files to your .Net solutions, you just need to add a NuGetDefaults.config file in the %ProgramData%\NuGet\NuGetDefaults.config directory of your build server. This file will be opened at each build requiring package restoration and will allow you to see your enterprise or personal NuGet package sources.

[Read More]

C# and JSON

If you need to use data formatted with the JSON standard, here is a simple trick to get started (but you can complicate it as you wish ;)). I use the Web Essentials extension and the NuGet package Json.NET. The JSON data file I use is this one: Example JSON File (source).

Here are the steps to take the JSON data, generate the necessary classes, download the data, and populate these new classes:

  • Install the Web Essentials extension
  • Create a new class file
  • Put a snippet or the entire JSON data into the clipboard (Copy or CTRL-C)
  • Right-click in the editor or go to the EDIT menu/Special Paste and select “Paste JSON as Classes”

image

[Read More]