[Mono-aspnet-list] Using C# 3.0? Error due to 2.0

Marek Habersack grendel at twistedcode.net
Fri Aug 6 09:52:36 EDT 2010


On Fri, 6 Aug 2010 07:22:52 +0100
william leader <william.leader at gmail.com> wrote:

Hey,

> To the best of my knowledge there are three options here:
> 
> 1) Change your code to contain full property implementations. Its not
> that much work. This was my choice.
> 
> 2) Add support for auto-implemented properties to Mono and submit a
> patch. Good luck.
They've been supported for ~2 years now

> 
> 3) Wait for someone else to add support for it to Mono. Good Luck.

There's nothing Mono specific to this error, the same thing would have happened on .NET 3.5. The
reason is that the .NET 3.5 compiler defaults to C# 2.0 and you need to let it know you're using C#
3.0 features in your _dynamically_ compiled code (i.e. code in App_Code or in files mentioned in
the CodeFile attribute). You do this by adding the following section to your web.config:

<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>

No need for any of the workarounds you gave above

marek

> On Thu, Aug 5, 2010 at 11:35 PM, Dizzy <hohenberger.jakob at gmail.com> wrote:
> >
> > Hey,
> >
> > I'm used to implement properties automatically. public Foo {get;set;}.
> >
> > Can I fix this error
> >
> > -- Code ---
> > error CS1644: Feature `automatically implemented properties' cannot be used
> > because it is not part of the C# 2.0 language specification
> > --- Code End ---
> >
> > without rewriting?
> >
> > Thanks
> > Jakob
> >
> > Edit: I'm using the latest mono version for Debian Lenny.
> > --
> > View this message in context:
> > http://mono.1490590.n4.nabble.com/Using-C-3-0-Error-due-to-2-0-tp2315695p2315695.html Sent from
> > the Mono - ASP.NET mailing list archive at Nabble.com.
> > _______________________________________________ Mono-aspnet-list mailing list
> > Mono-aspnet-list at lists.ximian.com
> > http://lists.ximian.com/mailman/listinfo/mono-aspnet-list
> >
> _______________________________________________
> Mono-aspnet-list mailing list
> Mono-aspnet-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-aspnet-list



More information about the Mono-aspnet-list mailing list