The CodeDom provider type "Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider ..." could not be located
Asked Answered
M

2

18

I published my website using visual studio publish option to my host.

my host uses asp.net 4.5.1 framework.

it works fine in local but after I published it, it gave this error.

enter image description here

my local visual studio solution folder contains a folder named packages and it contains some files is it related to error?

This is my config file(other lines omitted for the sake of clarity):

enter image description here

Thank you.

Monitorial answered 3/4, 2016 at 15:26 Comment(5)
Thanks for upvote, please guide meMonitorial
Please dont use image, but type the compilers line.Haircut
Are you running with full trust in the hosting environment? Also, to get the full, detailed error message, use a browser on the server hosting the website and browse to http://localhost/[Site]. You'll get the full error message. Failing that, change your web.config as described on the error pageDextrin
[site] what should this be?Monitorial
Possible duplicate of The CodeDom provider type "Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider" could not be locatedAmerce
T
11

The assembly version in the bin folder must match the version indicated in the compilers section of web.config file.

This error happens to me when i update the server bin folder. Because the package Microsoft.CodeDom.Providers.DotNetCompilerPlatform was updated i needed to update the compilers section of web.configtoo.

It can be done by simply updating the version attribute on the below example or replacing by entire section with the developer version.

<compilers>
  <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.3.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.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+" />
</compilers>

Doesn't require IIS restart.

Tirza answered 12/3, 2017 at 22:25 Comment(0)
S
1

Please go to Project > Properties. in "Package/Publish Web" tab and in "Items to deploy(applies to all deployment methods)" section and select "All files in this project folder" from drop down list and then Publish your Web Application again,

Hope Helpful.

Shriner answered 24/9, 2018 at 11:31 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.