views:

192

answers:

2

I have installed VS 2010 and created a new MVC application with it.

I have looked in the futures library as well as the source code from Code Plex and I can see that the function is in the ValidationExtensions class in the source code from Code Plex. Does anyone know how to get the source code from code plex to install with VS 2010 or do I just need to wait?

I suppose the easiest solution would be to just create my own ValidationExtensions and put the code in there but I am wondering what other things are different?

+1  A: 

I got this from Auriel, a developer on the ASP.NET team.

VS2010 Beta 2 ships with MVC 2 Preview 2, not MVC 2 Beta. MVC 2 Beta is not supported on VS2010 Beta 2. Yeah, the terminology is a bit confusing, unfortunately. :(

If you really need to get MVC 2 Beta to work on VS2010 Beta 2, see http://haacked.com/archive/2009/11/17/asp.net-mvc-2-beta-released.aspx#74907. Please note that this is entirely unsupported and could put your system into an unstable state. When VS2010 is released, it will include the final release version of MVC 2.

Ryan Pedersen
+1  A: 

If it's missing then do it yourself! :) I ran into the same problem myself and my solution was to add an extensionmethod that does the trick. In this way your code will be compatible with beta 2 and later releases:

namespace System.Web.Mvc.Html
{
    public static class Extensions
    {

        //TODO: Remove when ASP.NET MVC Gets updated, this method exists in beta2 and later releases

        public static MvcHtmlString ValidationMessageFor<TModel, TProperty>(
                this HtmlHelper<TModel> htmlHelper,
                Expression<Func<TModel, TProperty>> expression)
        {
            return htmlHelper.ValidationMessage(ExpressionHelper.GetExpressionText(expression));
        }

    }
}
Joakim Gyllstedt
You sir, are a god :)
Soulhuntre