Skip to content

Instantly share code, notes, and snippets.

@TerribleDev
Last active October 2, 2017 15:24
Show Gist options
  • Select an option

  • Save TerribleDev/39fc4f17202ebe0f8dc6cdef4594a079 to your computer and use it in GitHub Desktop.

Select an option

Save TerribleDev/39fc4f17202ebe0f8dc6cdef4594a079 to your computer and use it in GitHub Desktop.
Programmatically Set C# Language Version across many projects
using Microsoft.Build.Evaluation.Project;
using System.IO;
void Main()
{
var files = Directory.GetFiles(@"c:\projects\projectRoot\", "*.csproj", SearchOption.AllDirectories);
foreach (var file in files)
{
var project = new Project(file);
project.SetProperty("LangVersion", "6");
project.Save();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment