New Web Project fails to compile - error MSB6003: The specified task executable "csc.exe" could not be run


  • Hi All,

    I am creating my first ASP.NET Web Application and I think I must be making a rookie mistake. I've been through a couple of tutorials and everything seemed to work ok with new solutions, but when I add a new ASP.NET Web application to my existing solution as a project I get the following error:

    "Microsoft.Net.Compilers.1.0.0\tools\Microsoft.CSharp.Core.targets(67,5): error MSB6003: The specified task executable "csc.exe" could not be run. Could not load file or assembly 'Microsoft.CodeAnalysis.CSharp, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified."

    Considering that all I've done is create a new project and hit compile, I'm a little surprised that this doesn't work.

    I am using MSVS 2015 Professional and have added 2 new ASP.NET Web Applications (using .NET 4.5). Neither compiles out of the box and I can't find any clues online anywhere that seem relevant.

    Has anyone else encountered this or understand what I'm missing?

    • Edited by cartertj Monday, January 2, 2017 11:54 AM
    Monday, January 2, 2017 9:29 AM


  • Ok, I've found the problem, the NuGet package ,"Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0" needed to be updated to ,"Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.3". A rather cryptic error message that one. I can only image that because the project was new and the solution was old that some default settings on package versions got out of alignment. I can see a feature request there somewhere.

    So I guess the lesson there is if the compiler can't find the assembly even though a valid reference exists to the library that the assembly is in, then there is a good chance what it is actually trying to tell you is that the package is out of date.

    • Marked as answer by cartertj Monday, January 2, 2017 9:55 PM
    Monday, January 2, 2017 9:55 PM