Could not load type in Custom Profile provider

Posted by Cragly on Stack Overflow See other posts from Stack Overflow or by Cragly
Published on 2010-04-19T08:36:56Z Indexed on 2010/04/19 8:43 UTC
Read the original article Hit count: 629

I am writing a small console application in C# that references a custom assembly that implements custom .net Profile provider. I have added the following sections to my app.config file which references the custom class and assembly.

<system.web>
<profile defaultProvider="MyCompanyProfileProvider" inherits="MyCompany.Web.User.GenericProfile" automaticSaveEnabled="false">
    <providers>
        <clear/>
        <add name="MyCompanyProfileProvider" connectionStringName="defaultDatabase" applicationName="/myApplication" type="MyCompany.Web.ProfileProvider, MyCompany.Web"/>
    </providers>
    <properties>
        <add name="JobRoleId" type="System.Int32"/>
        <add name="LastCompetencyId" type="System.Int32" defaultValue="0"/>
        <add name="MixSettings" type="System.Xml.XmlDocument"/>
    </properties>
</profile></system.web>

However when I run the app in debug mode I get the following error as if it is looking in the System.Web assembly rather than one specified in the app.config file.

Could not load type 'MyCompany.Web.User.GenericProfile' from assembly 'System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.

I have a local web app that also uses the assembly and custom Profile provider and that work without any problems. I have checked the referenced assembly is being copied to the output directory.

Any ideas??

© Stack Overflow or respective owner

Related posts about c#

Related posts about asp.net-profiles