I got a very weird error after my computer was a little messed up with deleting various versions of VSs and SQL Servers. It seems like i fixed the project setup and had been a "good girl" following Microsoft's advices. However here is the error!when I open my project I get this window. From what I found it that VS 2012 for web by default targets 4.5 framework, so sound like my error just should not be happening.
I already tried following the second option and installing
whatever it wants,unfortunately nothing has changed error message
any suggestions that wont need me to re-install the the whole thing?
Try the web.config as this is the area where the error will most likely reside. You can 'force' the web.config to be a specific version and I would add both c# and vb/net so they are always there. I have a web.config template I start all my projects with. Below is a cut of the part I believe you need. Just change the value of the .net
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<providerOption name="CompilerVersion" value="v3.5"/>
<providerOption name="WarnAsError" value="false"/>
</compiler>
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" warningLevel="4" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<providerOption name="CompilerVersion" value="v3.5"/>
<providerOption name="OptionInfer" value="true"/>
<providerOption name="WarnAsError" value="false"/>
</compiler>
</compilers>
</system.codedom>
Related
I have an application written in aspx. The application, launching it from visual studio 2017 works correctly, using any browser.
But when publishing it, and running it on the server, I get the following error:
Parser error message: Could not locate provider type CodeDom "Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version = 2.0.0.0, Culture = neutral, PublicKeyToken = 31bf3856ad364e35".
I have tried with all the versions available in the Nuget Package Manager and I always get the same error, changing the installed version.
What I do is publish the application in the directory and upload it to any directory on the server. Enter the ASPX of the project and I get that error.
Is there any way to solve this?
The project was already installed previously, and I just have to update the source.
The project settings
The two extensions that give me problems
I have read in multiple sites that changing the version of the CodeDom, and I have followed the instructions to the letter and it has not worked
Just need to comment system.codedom tag in web.config file this work for me. like this
<!--<system.codedom>
<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=\"Web\" /optionInfer+" />
</compilers>
</system.codedom>-->
i can add a define to a WinForms project through the Project Properties:
How do i add a define to an ASP.net solution?
Update: Here's what Visual Studio 2010 looks like when working in an ASP.net solution:
Solution Explorer > WebApplicationProject (Name of your Web Application) > Properties > Build:
Have you tried using the compilerOptions attribute of the compilerv element in web.config? Like so:
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp"
extension=".cs"
warningLevel="4"
type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
compilerOptions="/define:TRACE">
<providerOption name="CompilerVersion" value="v3.5"/>
<providerOption name="WarnAsError" value="false"/>
</compiler>
....
Should do the trick I think...
I am trying to deploy two ASP.NET Application onto IIS 7. The first application I copied and pasted under wwwRooT folder and set Application Pool as Asp.NET 4.0 Integrated. For the second one, I created one virtual directory and set the Application Pool the same as the first application.
The first one works well, but the second one got exception:
The value for the 'compilerVersion' attribute in the provider options
must be 'v4.0' or later if you are compiling for version 4.0 or later of the .NET
Framework. To compile this Web application for version 3.5 or earlier of the .NET
Framework, remove the 'targetFramework' attribute from the element of
the Web.config file.
I had a similar problem and had to tell ASP.NET in configuration to use the 3.5 compiler as follows by modifying Web.config.
I've copied and pasted the following from my code. You have to change value="v3.5" to value="v4.0". The compiler type strings might also change.
<configuration>
<!-- ... other configuraiton stuff ... -->
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CSharp.CSharpCodeProvider,System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4">
<providerOption name="CompilerVersion" value="v3.5"/>
<providerOption name="WarnAsError" value="false"/>
</compiler>
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4">
<providerOption name="CompilerVersion" value="v3.5"/>
<providerOption name="OptionInfer" value="true"/>
<providerOption name="WarnAsError" value="false"/>
</compiler>
</compilers>
</system.codedom>
</configuration>
In my case the 2.0 compiler was being used instead of 3.5. I was working in an IIS 7, ASP.NET Website project.
You might glean additional insight from:
http://msdn.microsoft.com/en-us/library/system.codedom.aspx
http://msdn.microsoft.com/en-us/library/a15ebt6c%28VS.80%29.aspx
We have a website project. We are logging unhanded exceptions via a appdomain level exception handler.
When we set debug= true in web.config, the exception log is showing the offending line numbers in the stack trace.
But when we set debug = false, in web.config, log is not displaying the line numbers.
We are not in a position to convert the website project in to webapplication project type at this time. Its legacy application and almost all the code is in aspx pages. We also need to leave the project in 'updatable' mode. i.e. We can't user pre-compile option. We are generating pdb files.
Is there anyway to tell this kind of website projects to generate the pdb files, and show the line numbers in the stack trace?
Add compilerOptions="/debug:pdbonly" as an attribute to <compiler> in your web.config file:
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" compilerOptions="/debug:pdbonly" extension=".cs" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4">
<providerOption name="CompilerVersion" value="v3.5"/>
<providerOption name="WarnAsError" value="false"/>
</compiler><!-- removed vb.net stuff -->
</compilers>
</system.codedom>
Here's some more info on setting up compiler options in ASP.NET:
http://msdn.microsoft.com/en-us/library/a15ebt6c.aspx
When you precompile a directory that doesn't contain a web.config, the aspnet_compiler.exe defaults to CompilerVersion 2.0 and 3.5 code fails to compile. Is the following minimal web.config the only way to specify the CompilerVersion?
<?xml version="1.0"?>
<configuration>
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs" warningLevel="4"
type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<providerOption name="CompilerVersion" value="v3.5"/>
<providerOption name="WarnAsError" value="false"/>
</compiler>
</compilers>
</system.codedom>
</configuration>
We integrated asp.net precompilation with our build and integration environments and don't use web.configs for our control library components
Here you can find its parameters. Also note that ASP.NET Compilation tool is not available with versions of ASP.NET earlier than ASP.NET version 2.0.
For .NET 2.0 these are the steps you need to do
Start > run and type cmd.
set path=%windir%\Microsoft.NET\Framework\v2.0.50727
aspnet_compiler –v / –p c:\myproject\testsite c:\testcompile
I think that for other versions of .NET you have to cd to corresponding directory.
Also read this. You might find it useful.