Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8041801
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T04:20:45+00:00 2026-06-05T04:20:45+00:00

I am currently going through a tutorial using Visual Studio 11 beta. When trying

  • 0

I am currently going through a tutorial using Visual Studio 11 beta. When trying to set the max length of a field value in one of my classes:

[MaxLength(50)]
public string LastName { get; set; }

It errors out and wont let me compile because the MaxLength() function exists in two places:

Error 4 The type ‘System.ComponentModel.DataAnnotations.MaxLengthAttribute’ exists in both ‘c:\Users\me\Documents\Visual Studio 11\ContosoUniversity\packages\EntityFramework.4.1.10331.0\lib\net40\EntityFramework.dll’ and ‘c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\System.ComponentModel.DataAnnotations.dll’

I have tried to remove both files but that just causes more issues because other code in my project is dependent upon them.

Is there a way I can tell it to use one or the other?

All of these approaches don’t seem to be working for me.. Refer to the comments under the answers.. Any other ideas?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T04:20:47+00:00Added an answer on June 5, 2026 at 4:20 am

    Qualify the attribute with the desired namespace

    [System.ComponentModel.DataAnnotations.MaxLength(50)]
    public string LastName { get; set; } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've started using Mercurial for my personal projects and I'm currently going through Joel's
I am currently going through the tutorial examples on http://code.google.com/p/stanford-cs193g-sp2010/ to learn CUDA. The
I'm currently going through the ASP.NET MVC NerdDinner tutorial and am having a problem
I'm currently going through the Lynda Python tutorial and in the section on generators
I'm trying to learn ruby on rails. I've been going through a tutorial, but
I am currently going through an MVC3 tutorial. Binding on an IEnumerable is done
I'm currently going through a RoR tutorial ( http://railstutorial.org/chapters/sign-in-sign-out#sec:signin_success is the relevant section) which
I am currently going through one of the Android Tutorials . I found an
I am going through the tutorial at http://arcsynthesis.org/gltut/Positioning/Tut03%20More%20Power%20To%20The%20Shaders.html I am currently on a lesson
I'm currently going through the RoR guides, and i'm stuck at... Adding following/follower relationships

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.