Friday, August 1, 2008

type or namespace name 'ProfileCommon' could not be found

I recently hit this compile error while converting a Visual Studio web site project to a VS2008 Web App project: The type or namespace name 'ProfileCommon' could not be found (are you missing a using directive or an assembly reference?)

Turns out that Web Applications don't support the auto generation of the ProfileCommon object like web site projects do. To get this to work install this VS addin and then add it to the build process as described here.

6 comments:

  1. Thanks so much Ellis Rocks, U ROCK!

    ReplyDelete
  2. Isn't it possible to simply use:
    ProfileBase userProfile = ProfileBase.Create(userName, false);
    instead of :
    ProfileCommon userProfile = (ProfileCommon)ProfileCommon.Create(ouserName, false);
    Seems to work for me without the tools above.
    R

    ReplyDelete
  3. >Richard
    the reason why you would want to Generate the ProfileCommon class is that you can then get the strongly typed properties. With the profile base you are forced to write
    userProfile["MyProperty"]

    ReplyDelete
  4. ProfileBase userProfile = ProfileBase.Create(userName, false);

    ReplyDelete
  5. i have the same problem where i use like this

    ProfileCommon anonymousProfile = Profile.GetProfile(e.AnonymousID);

    and getting the same error. how can i make this work ?

    ReplyDelete