Compiling ASP.NET MVC 1.0 on Mono.

View: New views
3 Messages — Rating Filter:   Alert me  

Compiling ASP.NET MVC 1.0 on Mono.

by Tom Opgenorth :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello all,

For my own curiousity, I tried to compile the ASP.NET MVC 1.0 source
code on Mono 2.4.3 (Ubuntu 9.10 x64).  When I do so under either
MonoDevelop or xbuild, I get this error message:

Mvc/FormCollection.cs(24,6):   error CS0246:  The type or namespace
name `FormCollectionBinder' could not be found. Are you missing a
using directive or an assembly reference?

Now, FormCollectionBinder is an attribute that adorns the class
System.Web.MVC.FormCollection.  The declaration of
FormCollectionBinderAttribute is a private sealed class inside of
FormCollection.  If I move the code for this attribute outside of the
class declaration for FormCollection and then try to compile, there
seems to be no problems.

Could this be a bug with the compiler?  A simpler case is this:

using System;

namespace Test
{
        [MyAttribute]
        public class MyClass
        {
                private sealed class MyAttribute: Attribute
                {
                       
                }
                public void MyMethod()
                {
                  Console.WriteLine("Hello World!");
                }
        }
}

I could not get this to compile on Mono 2.4.3.  Or, is there something
special one must do to get this to compile?


--
http://www.opgenorth.net
_______________________________________________
Mono-list maillist  -  Mono-list@...
http://lists.ximian.com/mailman/listinfo/mono-list

Re: Compiling ASP.NET MVC 1.0 on Mono.

by Marek Habersack-6 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Tom Opgenorth wrote:
> Hello all,
Hello,

>
> For my own curiousity, I tried to compile the ASP.NET MVC 1.0 source
> code on Mono 2.4.3 (Ubuntu 9.10 x64).  When I do so under either
> MonoDevelop or xbuild, I get this error message:
>
> Mvc/FormCollection.cs(24,6):   error CS0246:  The type or namespace
> name `FormCollectionBinder' could not be found. Are you missing a
> using directive or an assembly reference?
>
> Now, FormCollectionBinder is an attribute that adorns the class
> System.Web.MVC.FormCollection.  The declaration of
> FormCollectionBinderAttribute is a private sealed class inside of
> FormCollection.  If I move the code for this attribute outside of the
> class declaration for FormCollection and then try to compile, there
> seems to be no problems.
>
> Could this be a bug with the compiler?  A simpler case is this:
Yes, and the bug was fixed after 2.4.3 was released.

>
> using System;
>
> namespace Test
> {
> [MyAttribute]
> public class MyClass
> {
> private sealed class MyAttribute: Attribute
> {
>
> }
> public void MyMethod()
> {
> Console.WriteLine("Hello World!");
> }
> }
> }
>
> I could not get this to compile on Mono 2.4.3.  Or, is there something
> special one must do to get this to compile?
A workaround is to move the attribute class outside its containing type.

marek


_______________________________________________
Mono-list maillist  -  Mono-list@...
http://lists.ximian.com/mailman/listinfo/mono-list

Re: Compiling ASP.NET MVC 1.0 on Mono.

by Tom Opgenorth :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Sat, Oct 31, 2009 at 15:40, Marek Habersack <grendel@...> wrote:
Now, FormCollectionBinder is an attribute that adorns the class
System.Web.MVC.FormCollection.  The declaration of
FormCollectionBinderAttribute is a private sealed class inside of
FormCollection.  If I move the code for this attribute outside of the
class declaration for FormCollection and then try to compile, there
seems to be no problems.

Could this be a bug with the compiler?  A simpler case is this:
Yes, and the bug was fixed after 2.4.3 was released.
I just ended up tweaking the ASP.NET MVC source and moved the code for the attribute outside the class, all is good now.
 
 


--
http://www.opgenorth.net


_______________________________________________
Mono-list maillist  -  Mono-list@...
http://lists.ximian.com/mailman/listinfo/mono-list