Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a Microsoft.Net.Compilers equivalent for C# 7.0?

Tags:

asp.net

c#-7.0

When C# 6 arrived I just referenced the Microsoft.Net.Compilers NuGet package and TFS builds of C# 6 features started working right away without having to install additional dependencies on the build machine.

Now that C# 7 is here is there an equivalent NuGet package that can do the same thing? (or is this not really a recommended way of adopting C# 7?)

The description for the Microsoft.Net.Compilers package does say that it "causes the project to be built using the specific version of the C# [...] compilers contained in the package", however I can't find out what the corresponding C# compiler version is for a given NuGet package. I've tried adding the latest stable version (1.3.2) however C# 7 features aren't compiling (and this package is ~6 months old anyway, so I wouldn't really have expected it to work)

like image 379
Justin Avatar asked Mar 07 '17 21:03

Justin


People also ask

What is the point of Microsoft NET compilers?

A brief overview would be appreciated. Show activity on this post. The point of the Microsoft.Net.Compilers package is that the compilers distributed with that package will be used for compiling your project, rather than the compiler that comes with .NET Framework or with Visual Studio.

Is there a replacement package for Microsoft NET compilers?

There is a successor package named Microsoft.Net.Compilers.Toolset. This package has much the same functionality as Microsoft.Net.Compilers but works with both .NET Desktop and .NET Core MSBuild instances. Even so Microsoft.Net.Compilers.Toolset is not meant for general consumption.

What are compiler options in C #?

This section describes the options interpreted by the C# compiler. Options are grouped into separate articles based on what they control, for example, language features, code generation, and output. Use the table of contents to navigate amongst them. There are two different ways to set compiler options in .NET projects:

What versions of the NET Framework are compatible with my application?

The .NET Framework 4.5 and later versions are backward-compatible with apps that were built with earlier versions of the .NET Framework. In other words, apps and components built with previous versions will work without modification on the .NET Framework 4.5 and later versions.


1 Answers

An updated Microsoft.Net.Compilers package was published the same week that VS2017 was released.

See the Roslyn documentation about what package version corresponds to which C# language version.

like image 190
Julien Couvreur Avatar answered Nov 03 '22 00:11

Julien Couvreur