As of November, people outside of the Roslyn team have been able to build and dogfood changes they make to the compiler and language services. Now that the various feature branches have caught up, we can start playing around with some of the proposed features for C#.
I’ve also prepared a video on How to Test out C# 7 Features with Roslyn
The current branches available on GitHub are:
features/Nullable Reference Types
/future branch is where all these features end up once they’re close to complete and ready to be reviewed for more feedback. Today (Feburary 9, 2015) it’s home to binary literals, digit separators and local functions.
Today we’re going to look at the steps necessary to get the
/future branch to build and let us test out the new features.
Cloning and Building Roslyn
The first steps are identical to those found on Roslyn’s “Building Debugging and Testing on Windows” guideline.
- Clone https://github.com/dotnet/roslyn
- Check out the
- Run the “Developer Command Prompt for VS2015” from your start menu.
- Navigate to the directory of your Git clone.
Restore.cmdin the command prompt to restore NuGet packages. (Note: This sometimes takes up to 30 minutes to complete and may appear to be frozen when it’s not)
- Build on the command line before opening in Visual Studio. Run
msbuild /v:m /m Roslyn.sln
Enabling C# 7 Features in Visual Studio
- Navigate to
- Force it to
return trueto enable all available features
- In the Solution Explorer, set the
VisualStudioSetupproject as the startup project and press F5 to run.
- A new instance of Visual Studio will open with the C# 7 features available for use within VS.
Note: Although there will be no error squiggles in the editors, you won’t be able to perform full-builds until you deploy your changes to the out-of-process compiler.
Enabling C# 7 Features in Out-of-process compiler
To enable full builds within your experimental Visual Studio:
- Make the above changes.
- Deploy them to the
There you have it, you can test out local functions, binary literals and digit separators. You can also use a similar approach to try out some of the other feature branches.