Problem
I’m attempting to execute an Asp.net MVC project that was downloaded from TFS source control. I’ve inserted all assembly references, and I’m able to correctly build and compile without any errors or warnings.
However, I receive the following problem in my browser:
The error page is seen in its entirety below.
I discovered that Roslyn is after a few days of investigation. Net compiler platform with advanced compiling capabilities. However, I’m not sure why my build is looking for binroslyncsc.exe because I haven’t configured anything about Roslyn and don’t plan to use it in my project.
Asked by Eyad
Solution #1
TL; DR
perform the following command in the Package Manager Console:
Update-Package Microsoft.CodeDom.Providers.DotNetCompilerPlatform -r
More information
Because this issue is unrelated to Visual Studio, suggestions for adding build steps to copy files across are more of a workaround. The same goes for manually adding compiler binaries to the project.
The Roslyn compiler is part of a NuGet package, and some versions of that package (I’m not sure which ones) have/had a flaw. Reinstalling/upgrading the software to a bug-free version is the solution. Originally, I fixed it before writing the answer in 2015 by installing the following packages at specific versions:
Then I went into.csproj and double-checked that the package paths were accurate (in my case,….packages*.*) inside the tags ImportProject> at the top and Target> with the name “EnsureNuGetPackageBuildImports” at the bottom. MVC 5 and the.NET Framework 4.5.2 are used.
Answered by andy250
Solution #2
The issue with the default VS2015 templates is that the compiler is copied to the outdirroslyn directory rather than the tfrbinroslyn directory.
Add the following code to 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>
Answered by Mitchell
Solution #3
For me, a clean and rebuild worked!
Answered by pipedreambomb
Solution #4
Because the following packages have been added to your project, your build is looking for binroslyncsc.exe. Simply check your packages.config file to see if both of them are present.
Microsoft.CodeDom.Providers.DotNetCompilerPlatform
Microsoft.Net.Compilers
If you don’t want to use Roslyn, follow the instructions below to get rid of it.
1. Using the Nuget Package Console, remove NuGet packages using the commands below.
PM> Uninstall-package Microsoft.CodeDom.Providers.DotNetCompilerPlatform
PM> Uninstall-package Microsoft.Net.Compilers
2. Your web.config file should be automatically changed after this. If it isn’t, look in the web.config file for the following code, and if it’s there, remove it.
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701"></compiler>
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\"Web\" /optionInfer+"></compiler>
</compilers>
</system.codedom>
Answered by Malik Khalil
Solution #5
Here’s a more MSBuild-friendly method to do it.
<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>
However, the roslyn files are also there in my bin directory (not in a folder). However, the app appears to operate.
Answered by Rob Cannon
Post is based on https://stackoverflow.com/questions/32780315/could-not-find-a-part-of-the-path-bin-roslyn-csc-exe