Reputation: 1
I have been trying to make a project, but in web.config, it keeps giving me the error that it doesn't recognize the attribute TargetFramework.
EDIT: Added the web.config. I have seen one question with the same problem and they said there that it should be the same version as the version of ASP.NET. But i don't really see how to do that.
P.S. i can't change to a different version of Visual Studio (i use that program) since it won't allow me to run the files on local web. But that's a different problem.
Been a while now. Guess it's a tough problem.
<?xml version="1.0"?>
<!--
Note: As an alternative to hand editing this file you can use the
web admin tool to configure settings for your application. Use
the Website->Asp.Net Configuration option in Visual Studio.
A full list of settings and comments can be found in
machine.config.comments usually located in
\Windows\Microsoft.Net\Framework\v2.x\Config
-->
<configuration>
<appSettings/>
<connectionStrings/>
<system.web>
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
-->
<compilation debug="true" targetFramework="4.0">
<assemblies>
</assemblies>
</compilation>
<!--
The <authentication> section enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
<authentication mode="Windows"/>
<!--
The <customErrors> section enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
it enables developers to configure html error pages
to be displayed in place of a error stack trace.
<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
-->
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/> </system.web>
<system.codedom>
</system.codedom>
<!--
The system.webServer section is required for running ASP.NET AJAX under Internet
Information Services 7.0. It is not necessary for previous version of IIS.
-->
<system.webServer>
</system.webServer>
</configuration>
Upvotes: 0
Views: 683
Reputation: 1
I've gotten this error when trying to use Fortify with Visual Studio. The Visual Studio Fortify plugin seems to want to use the aspnet_compiler instead of msbuild. It was throwing that exact message.
When I used the command line tools to have Fortify compile using msbuild, it worked. Perhaps your Visual Studio is not using msbuild? You may want to try converting it to a web application if it's not already. I think then Visual Studio will use MSBuild by default. Not sure if this is your problem, but I did get that exact same error message. Good luck.
Upvotes: 0
Reputation: 9416
This happens basically when you have an attribute of targetFramework="4.0" in the web.config but the App Pool is set to run ASP.NET 2.0. The targetFramework attribute is entirely unrecognized by ASP.NET 2.0 -This means it will not work even if you changed it to 2.0 in config file.
If your application is coded in 4.0 then the AppPool is need to be set up to 4.0 In IIS > Right click on WebSite > Properties > ASP.NET > Version > "Should read 4.0.21006" not 2.0
Upvotes: 3