Start | Blogs | Umbraco | Roslyn error



How to solve Roslyn not found error

When deploying your Umbraco site to your webserver for the first time or even when working locally and installing an Umbraco project, you are fairly like to get a Roslyn not found error. This is because the Roslyn does not automatically get installed when compiling. My previous solution was to upload my Roslyn folder to the production server. But now I have managed to let Azure pipelines build server include Roslyn when building.

Add the following to the .csproj file in your web project: 

  <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)" />




run this command in package manager console targeting the project that is failing:

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