ASP.Net - Could not find a part of the path ... bin\roslyn\csc.exe Code Example

The code for Could not find a part of the path ... bin\roslyn\csc.exe

Solution 1:
Run this in the Package Manager Console:

Update-Package Microsoft.CodeDom.Providers.DotNetCompilerPlatform -r

Solution 2:
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)'">
    <ItemGroup>
      <RoslynFiles Include="$(CscToolPath)\*" />
    </ItemGroup>
    <MakeDir Directories="$(WebProjectOutputDir)\bin\roslyn" />
    <Copy SourceFiles="@(RoslynFiles)" DestinationFolder="$(WebProjectOutputDir)\bin\roslyn" SkipUnchangedFiles="true" Retries="$(CopyRetryCount)" RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)" />
</Target>
Code by IncludeHelp, on February 28, 2023 07:50
Reference: stackoverflow

Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.