Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix configuration error 'The CodeDom provider type could not be located' and parsing error 'Could not load type' leading to each other?

I'm currently working on a project, that includes ASP.net, JS, C#, Html and etc. My project was working fine and had no problem to load whats so ever and neither had any problems running using IIS express (10.0). I added a few more classes and edited a web form, and when I tried to run the code in order to check my work, I had the 'Server Error in '/' Application. Configuration Error' thrown.

Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately. Parser Error Message: The CodeDom provider type "Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" could not be located.

Source Error:

Line 31: <system.codedom>
Line 32: <compilers>
Line 33: <compiler language="c#;cs;csharp" extension=".cs"
Line 34: type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
Line 35: warningLevel="4" compilerOptions="/langversion:default /nowarn:1659;1699;1701"/>

Source File: C:\Users\Dell\Desktop\School\מדעי המחשב\WebProject\Project\web.config Line: 33

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.8.4075.0

when I tried searching for a solution, I've found a few, but they all led me to a "Parser error", 'Could not load type'.

Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: Could not load type 'Project.Global'.

Source Error:

Line 1:  <%@ Application Codebehind="Global.asax.cs" Inherits="Project.Global" Language="C#" %>

Source File: /global.asax Line: 1

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.8.4075.0

No matter what method nor approach I'm trying to use in order to solve any of these problems, I always seem to get back to the second one... Could anyone please help?

like image 980
Daniel Danai Avatar asked Dec 23 '22 17:12

Daniel Danai


1 Answers

It's likely because you have

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

in your Web.config file but the Microsoft.CodeDom.Providers.DotNetCompilerPlatform package is not installed in the project. Check your project package references to see if the package is installed. If it's not, go to Nuget Package Manager and install Microsoft.CodeDom.Providers.DotNetCompilerPlatform.

like image 185
Akhils Avatar answered Apr 27 '23 16:04

Akhils