1
votes

I'm using Visual Studio 2015 and I target my application to .NET Framework 4.6.1. I'm building a Web Site project and there are several class libraries in the same solution.

I can use C# 6 features in the class libraries (e.g. null propagation operator ?., but not in the WebSite project), it will give the error

Feature 'null propagating operator' is not available in c# 5. Please use language version 6 or greater.

Why is it that I can use this feature in class library but not in the Website? Then, I tried adding the support for C# 6 through the Website menu which will download the CodeDom and the compiler into the packages directory and link it in Web.config file.

enter image description here

I can compile and it runs fine on my localhost, but when I deploy to my testing server, I get the following error:

Parser Error Message: The CodeDom provider type "Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" could not be located.

How to solve this?

1
The following thread might be related to your question: stackoverflow.com/questions/33319675/… - ivayle
The most upvoted answer there is to remove reference of the CodeDom in the Web.config. But if I remove it, then I can't use C#6 features in the Website. - rcs

1 Answers

0
votes

Try to install or reinstall Microsoft.CodeDom.Providers.DotNetCompilerPlatform

Install-Package Microsoft.CodeDom.Providers.DotNetCompilerPlatform
Install-Package Microsoft.CodeDom.Providers.DotNetCompilerPlatform - reinstall