Try our conversational search powered by Generative AI!

CMS 11.3.2 - Could not find a part of the path 'bin\roslyn\csc.exe'



Upgraded to CMS 11. Local dev computer works fine. When i build/deploy with jenkins  the build is ok and it deploys it, But all my tests fails (500 error) 

and when i visit the site url server gives me this error:

Could not find a part of the path 'C:\Episerver\Sites\xxx\bin\roslyn\csc.exe'. Server Error in '/' Application.

Could not find a part of the path 'C:\Episerver\Sites\xxx\bin\roslyn\csc.exe'.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Episerver\Sites\xxx\bin\roslyn\csc.exe'.

Guess some of you had the same issue. What is the best way to fix this?

Jan 22, 2018 13:22

If i publish to the server from visual studio the site works

Jan 22, 2018 14:17

Looks like there is an issue with the jenkins server. Anybody known what needs to be updated?

Jan 22, 2018 14:33


This is a known issue with Microsoft.CodeDom.Providers.DotNetCompilerPlatform 1.0.6. Downgrading to 1.0.5 fixed this for me.

You can even update it to latest 1.0.8. It should fix the issue.

Please check the below url for other options.



Jan 22, 2018 18:25

Hi. I am using 1.0.8 and it works on my computer. It works when i do a manual deploy to dev test server (Normally jenkins server does this).

The problem is that the CopyRoslynCompilerFilesToOutputDirectory does not run after compile is done.

MSBuild.exe xxx.sln /p:Configuration=Release

When i built this way i see a CopyRoslynCompilerFilesToOutputDirectory and my bin gets the files

  wwwroot -> D:\Jenkins\workspace\XXX - Build Gerrit\xxx\wwwroot\bin\wwwroot.dll
  Creating directory "D:\Jenkins\workspace\xxx - Build Gerrit\xxx\wwwroot\bin\roslyn".
  Copying file from "D:\Jenkins\workspace\xxx - Build Gerrit\xxx\packages\Microsoft.Net.Compilers.2.4.0\build\..\tools\csc.exe" to "D:\Jenkins\workspace\xxx - Build Gerrit\xxx\wwwroot\bin\roslyn\csc.exe".
  Copying file from "D:\Jenkins\workspace\xxx - Build Gerrit\xxx\packages\Microsoft.Net.Compilers.2.4.0\build\..\tools\csc.exe.config" to "D:\Jenkins\workspace\xxx - Build Gerrit\xxx\wwwroot\bin\roslyn\csc.exe.config".
  Copying file from "D:\Jenkins\workspace\xxx - Build Gerrit\xxx\packages\Microsoft.Net.Compilers.2.4.0\build\..\tools\csc.rsp" to "D:\Jenkins\workspace\xxx - Build Gerrit\xxx\wwwroot\bin\roslyn\csc.rsp".

There is more files here here but i did not include all

The problem is visible when i add DeployOnBuild=true;DeployTarget=Package (the CopyRoslynCompilerFilesToOutputDirectory does not trigger and the package does not work).

MSBuild.exe xxx.sln /p:Configuration=Release;DeployOnBuild=true;DeployTarget=Package;_PackageTempDir=' + project.buildDir + '/publish;PackageLocation=' + project.buildDir + '/'

It did a reinstall/update of Build Tools for Visual Studio 2017 (make sure i had latest msbuild)

If i compile first and then run the command above the package it works (the zip package bin folder contains the roslyn folder with files)

Is this a Bug in msbuild?

Edited, Jan 23, 2018 9:49
<p>It looks like we need a change in the Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props file under packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.8\build\net45</p> <p>I added back in a target from the 1.0.5 version by adding back in</p> <p>&lt;Target Name="IncludeRoslynCompilerFilesToItemGroup" AfterTargets="ResolveAssemblyReferences" &gt;<br />&lt;ItemGroup&gt;<br /> &lt;None Include="@(RoslyCompilerFiles)" Condition=""&gt;<br /> &lt;Link&gt;%(RoslyCompilerFiles.Link)&lt;/Link&gt;<br /> &lt;CopyToOutputDirectory&gt;PreserveNewest&lt;/CopyToOutputDirectory&gt;<br /> &lt;/None&gt;<br />&lt;/ItemGroup&gt;</p> <p>before</p> <p>&lt;Target Name="CopyRoslynCompilerFilesToOutputDirectory" ... /&gt;</p> <p>and publishing should work again.</p> <p>Let me know if you face any other issues , when you are updating this.</p> <p></p>
Jan 23, 2018 10:26

I guess this code only works on 1.0.5. I think i found a better way.

At the moment i just run MSBuild.exe twice (added a todo to remove this when it works again). One for build - MSBuild.exe xxx.sln /p:Configuration=Release (triggers copy roslyn files). Then i call MSBuild.exe again for creating package/zip file.

It works. I will revisit this commit and try to fix it in a couple of months.

Jan 23, 2018 13:00
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.