Quantcast
Channel: Could not find a part of the path ... bin\roslyn\csc.exe - Stack Overflow
Viewing all articles
Browse latest Browse all 62

Answer by Ciaran for Could not find a part of the path ... bin\roslyn\csc.exe

$
0
0

I experienced this error on a Jenkins build server running MSBuild, which outputs the build files to a separate folder location (_PublishedWebsites). Exactly the same - the roslyn folder was not in the bin directory, and all the roslyn files were lumped in with the bin files.

@igor-semin 's answer was the only thing that worked for me (as I am using the C# 6 language features, I cannot simply uninstall the nuget packages as per other answers), but as I am also running CodeAnalysis, I was getting another error on my deployment target server:

An attempt to override an existing mapping was detected for type Microsoft.CodeAnalysis.ICompilationUnitSyntax with name "", currently mapped to type Microsoft.CodeAnalysis.CSharp.Syntax.CompilationUnitSyntax, to type Microsoft.CodeAnalysis.VisualBasic.Syntax.CompilationUnitSyntax.

The reason for this is that as the roslyn files are getting dumped into the main bin directory, when you run the xcopy to recreate them in the nested roslyn folder, you now have 2 copies of these files being compiled and there is a clash between them. After much frustration I decided on a 'hack' fix - an additional post-build task to delete these files from the bin directory, removing the conflict.

The .csproj of my offending projects now looks like:

................... more here ......................

<PropertyGroup><PostBuildEvent>   if not exist "$(WebProjectOutputDir)\bin\Roslyn" md "$(WebProjectOutputDir)\bin\Roslyn"   start /MIN xcopy /s /y /R "$(OutDir)roslyn\*.*""$(WebProjectOutputDir)\bin\Roslyn"</PostBuildEvent></PropertyGroup><Target Name="DeleteDuplicateAnalysisFiles" AfterTargets="AfterBuild"><!-- Jenkins now has copies of the following files in both the bin directory and the 'bin\rosyln' directory. Delete from bin. --><ItemGroup><FilesToDelete Include="$(WebProjectOutputDir)\bin\Microsoft.CodeAnalysis*.dll" /></ItemGroup><Delete Files="@(FilesToDelete)" /></Target>

................... more here ......................


Viewing all articles
Browse latest Browse all 62

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>