Azure WebApp Deployment: Throw Expression Causes CS1525 Compiler Error

I am currently using the new throw expression in C # as such:

_configurator = configurator ?? throw new ArgumentException(nameof(configurator));

It compiles easily inside Visual Studio 2017, however, when it is deployed in my intermediate slot from my version control (in this case, BitBucket), it fails:

Repositories\UserRepository.cs(46,45): error CS1525: Invalid expression term 'throw' [D:\home\site\repository\foo\foo.csproj]

This happens in several places in my project.

How can I configure my WebApp to allow compilation of this new throw function? The only workaround I found now is to compile it locally and manually publish through Visual Studio. I would like to use the automatic deployment option that Azure allows.

I found this error , which relates to a local project, but I'm not sure how to update Microsoft.Net.Compilers on WebApp. My slot is installed in .NET 4.6

Thank,

+4
source share
1 answer

Try adding a link to the Microsoft.Net.CompilersNuGet package in all projects in the solution. See https://github.com/projectkudu/kudu/issues/2350 for more details .

+4
source

Source: https://habr.com/ru/post/1674852/


All Articles