Error: Could not find a part of the path ‘E:\sitesroot\0\bin\roslyn\csc.exe’.


After publishing the web app to Azure Cloud Services from Visual Studio 2017, it would not run and returned a 500 error.  Turning off custom error messages I was getting this error: Could not find a part of the path 'E:\sitesroot\0\bin\roslyn\csc.exe'. In your solution explorer for your project, right click on the ‘References’ section for your WebRole and select ‘Manage NuGet Packages…’ full stack:

[DirectoryNotFoundException: Could not find a part of the path 'E:\sitesroot\0\bin\roslyn\csc.exe'.]
   System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) +548
   System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) +1159
   System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share) +133
   Microsoft.CodeDom.Providers.DotNetCompilerPlatform.Compiler.get_CompilerName() +127
   Microsoft.CodeDom.Providers.DotNetCompilerPlatform.Compiler.FromFileBatch(CompilerParameters options, String[] fileNames) +832
   Microsoft.CodeDom.Providers.DotNetCompilerPlatform.Compiler.CompileAssemblyFromFileBatch(CompilerParameters options, String[] fileNames) +189
   System.Web.Compilation.AssemblyBuilder.Compile() +2038
   System.Web.Compilation.BuildProvidersCompiler.PerformBuild() +325
   System.Web.Compilation.ApplicationBuildProvider.GetGlobalAsaxBuildResult(Boolean isPrecompiledApp) +406
   System.Web.Compilation.BuildManager.CompileGlobalAsax() +47
   System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +366

[HttpException (0x80004005): Could not find a part of the path 'E:\sitesroot\0\bin\roslyn\csc.exe'.]
   System.Web.Compilation.BuildManager.ReportTopLevelCompilationException() +76
   System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +642
   System.Web.Compilation.BuildManager.CallAppInitializeMethod() +34
   System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +927

[HttpException (0x80004005): Could not find a part of the path 'E:\sitesroot\0\bin\roslyn\csc.exe'.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +534
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +119
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +726


A bug in Microsoft.CodeDom.Providers.DotNetCompilerPlatform package 1.0.7


Upgrade package to 1.0.8


You will notice Updates will have some updates available and select the Microsoft.CodeDom.Providers.DotNetCompilerPlatform ‘Latest stable 1.0.8’ and hit the Update button.


Publish your application.

Now you may have to wait a bit as the role drains any existing connections, but eventually this will result in getting rid of this pesky error!

Comments (2)
  1. Henry Stark says:

    That’s awesome! Thanks. But why is this? Still is bug? Previously, I used version 2.0.0 in my application, and I found there is an available update to 2.0.1 by following your guidance. I just updated it, which resolved my issue.

  2. Jeff Sanders says:

    Hi Henry,
    I am glad that worked for you. I am not sure frankly and I although I work for Microsoft, I do not support that product nor do I represent that team. Just trying to share my experiences and knowledge here!

Comments are closed.

Skip to main content