I have a .NET 3.5 (target framework) web application. I have some code that looks like this:
public string LogPath { get; private set; }
public string ErrorMsg { get; private set; }
It's giving me this compilation error for these lines:
"must declare a body because it is not marked abstract or extern."
Any ideas? My understanding was that this style of property was valid as of .NET 3.0.
Thanks!
The problem turned out to be in my .sln file itself. Although I was changing the target version in my build options, in the .sln file, I found this:
TargetFramework = "3.0"
Changing that to "3.5" solved it. Thanks, guys!
add to web.config
<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>
</compilers>
</system.codedom>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With