简体   繁体   中英

IIS 7 unable to find Microsoft.CodDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider DLL

So when deploying our web service using a customized build configuration, after deploying I get the error:

The CodeDom provider type "Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, could not be located.

when trying to browse the site. Looking in the bin\\~configurationName~ folder, I can find the specified DLL just fine though. The error is referencing these lines in my web.config:

  <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 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=\&quot;Web\&quot; /optionInfer+" />
    </compilers>
  </system.codedom>

Odd thing is when building/deploying for Debug on the same server, I don't run into this issue and everything seems to work fine (which leads me to believe this error exists with my project configuration, not the deployment server). The configuration I'm building for when getting this error is our custom defined QA config, which outputs to bin\\QA, so I'm wondering if there's something special I need to do to get the ASP.NET compiler to look at special output folders?

The deployment solution for a longer term is avoid using Roslyn for the moment.

The problem is that you are using Roslyn Compiler and references on IIS. Roslyn is still not having full support at many deployment servers.

Solution is to remove Roslyn as this won't affect project functionality!

I wrote similar answer to another question that is related to almost this kind of problem. Take a look at my answer https://stackoverflow.com/a/42668206/1436594

So this was caused because I had nested all the assemblies for the site under a folder with the configurations name like you would do in a console/windows app (eg 'bin\\Debug'). For web applications, the assemblies do not get nested under a config folder (eg they should go in 'bin\\').

Hope this helps others!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM