Could not find file 'D:\Projects\frombackup\CP\CP\bin\roslyn\csc.exe RRS feed

  • Question

  • User1052662409 posted

    Hi All,

    I am working on MVC5  using EF6.

    Sometimes when I run the project it shows error

    Could not find file 'D:\Projects\frombackup\CP\CP\bin\roslyn\csc.exe

    Sometime it auto corrects but after some times it comes again.

    Why this happens.

    Tuesday, June 11, 2019 1:41 PM

All replies

  • User-1038772411 posted

    Hi, Demoninside9

    The problem with the default VS2015 templates is that the compiler isn't actually copied to the tfr\bin\roslyn\ directory, but rather the {outdir}\roslyn\ directory

    Add this code in your .csproj file:

    <Target Name="CopyRoslynFiles" AfterTargets="AfterBuild" Condition="!$(Disable_CopyWebApplication) And '$(OutDir)' != '$(OutputPath)'">
          <RoslynFiles Include="$(CscToolPath)\*" />
        <MakeDir Directories="$(WebProjectOutputDir)\bin\roslyn" />
        <Copy SourceFiles="@(RoslynFiles)" DestinationFolder="$(WebProjectOutputDir)\bin\roslyn" SkipUnchangedFiles="true" Retries="$(CopyRetryCount)" RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)" />


    Tuesday, June 11, 2019 1:46 PM