I have a cons开发者_如何学编程ole application which has target .NET 2.0
It is very short but full of unsafe code.
I converted it to VS 2010. I run it OK.
When I try to change "target framework" in properties to 3.5 or 4.0 it shows message box:
TargetFrameworkMoniker: Error parsing application configuration file at line 0. XML document must have a top level element.
the target then stays 2.0 anyway.
This happened to me because my project file was marked as "Read Only" in its properties. Changed it, and it was fine.
It also could be caused by read-only app.config/web.config
Found the solution. Simply opened app.config in text pad (it was empty for some reason) and pasted:
<?xml version="1.0"?>
<configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
For me the problem was the web.config file located outside of the project directory. I moved it back in, and was able to change the target framework.
I have same issue. I solved it by removing write protected attribute of web.config file. It was read only earlier.
For me, my project was using a web.config file that was a linked file back to a web.config in another project. I removed the link, changed the target, then added the link back.
I faced this problem , i solved it by click app.config to open it and leave it ,then go to properties and upgrade .NET version
I was trying to retarget from .NET 4.5.2 to .NET 4.5 In my app.config, I had to change
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
to
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
before the project properties page would let me retarget.
精彩评论