Can Roslyn target CoreFX?


Sorry if I missed this somewhere but is it currently possible to compile an application targeting .NET Core (coreclr, corefx) in Visual Studios 2013 at this time? Or is it Visual Studios 2015 only?

#Main Question…
How do I use Roslyn to compile and target the CoreFX framework instead of the normal .NET framework?
Also is it possible to use Roslyn to target my own limited subset of .NET features? I’m guessing the answer is yes because of CoreFX but am unclear as how to change Roslyn’s .NET framework target. Maybe this is done in the “csproj” settings? But to what?



Just noticed this question.

The high level answer is yes.

The longer winded answer is that we’re working on a plan to make it easier and to be wired through the normal workflow. We’re entertaining various ideas for what the “target” would be when compiling using MSBuild. In the end, we need the build system to resolve the right set of assemblies to compile against and pass them to the compiler. One current proposal is to use a “Meta-package” on NuGet that you would reference and let NuGet pull in the closure of dependencies that represents a certain version of .NET Core. This requires that we put in place the right build and NuGet support.

This discussion was happening in the gitter chatroom on the coreclr repo but there should be a discussion topic either here or on the coreclr repo popping up soon.


I’d like to confirm @Petermarcu’s reply - one of my peers, Kevin Pilch-Bisson may also have details to share over time.

If you constrain the question to just the .NET compilers for C# or VB, yes - Roslyn is indeed compatible with CoreCLR and the new API model for CoreFX. In fact, you can try this out already when you use ASP.NET Core 5.

As Peter mentions, support for MSBuild-based workflows is still being ironed out. I’m excited as you are about it though!

Hope this helps,
Theo Yaung
Engineering Lead, Roslyn Compiler

.NET Foundation Website | Blog | Projects | Code of Conduct