Could not find a part of the path ‘\bin\roslyn\csc.exe’.

16/02/2019

This error message when I try to run a ASP.net web application have happened to me twice within a few weeks, to I thought I would add a solution to fix it.

It seems to happen when you get an updated version of a project on a machine that already have a package folder with older versions of the nuget libraries that have been updated in the latest version.

So the sure fix I found, is to redownload everything.


[DirectoryNotFoundException: Could not find a part of the path 'c:\projects\letsencrypt-siteextension\LetsEncrypt-SiteExtension\bin\roslyn\csc.exe'.]
System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) +219
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) +776
System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share) +65
Microsoft.CodeDom.Providers.DotNetCompilerPlatform.Compiler.get_CompilerName() +91
Microsoft.CodeDom.Providers.DotNetCompilerPlatform.Compiler.FromFileBatch(CompilerParameters options, String[] fileNames) +659
Microsoft.CodeDom.Providers.DotNetCompilerPlatform.Compiler.CompileAssemblyFromFileBatch(CompilerParameters options, String[] fileNames) +186
System.CodeDom.Compiler.CodeDomProvider.CompileAssemblyFromFile(CompilerParameters options, String[] fileNames) +23
System.Web.Compilation.AssemblyBuilder.Compile() +942
System.Web.Compilation.BuildProvidersCompiler.PerformBuild() +306
System.Web.Compilation.ApplicationBuildProvider.GetGlobalAsaxBuildResult(Boolean isPrecompiledApp) +272
System.Web.Compilation.BuildManager.CompileGlobalAsax() +44
System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +312