Link to home
Start Free TrialLog in
Avatar of Julian Hansen
Julian HansenFlag for South Africa

asked on

Compilation Error: The type 'ProfileCommon' exists in both ... ???

We have a site that has been up and running for a while. Out of nowhere this error started appearing when trying to access the site.

CS0433: The type 'ProfileCommon' exists in both 'c:\windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\cf2b8434\95f525a3\App_Code.0i70ivrk.dll' and 'c:\windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\cf2b8434\95f525a3\assembly\dl3\ec82ca57\4c212851_fe6ecd01\App_Code.DLL'

Has anyone had any experience with this
SOLUTION
Avatar of Vikram Singh Saini
Vikram Singh Saini
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Julian Hansen

ASKER

How do you do that on a hosted server?
I think that would not be possible on hosted server.

But I found a link that describe your problem :

http://gregorybeamer.wordpress.com/2008/09/26/solving-the-profilecommon-ambiguous-error/
Just a hunch; I'd be inclined to suspect an applicationName conflict in the web.config.
<add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="mycn" applicationName="/" />

Most people deploy their apps using the "/" as the application name, which leaves it up to IIS to figure it out.

Try:
<add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="mycn" applicationName="/mywebsite" />

Alan
Thanks Alan,

The application name was set to the application name i.e. not '/'. As an added test I changed it to something else - same problem.

The error points to this bit of code
Line 125:          protected ProfileCommon Profile {
Line 126:              get {
Line 127:                  return ((ProfileCommon)(this.Context.Profile));
Line 128:              }
Line 129:          }

Open in new window

The web config does define a custom profile provider like so - I did read somewhere that something in this could be the problem - but not sure how to proceed ....
		<membership defaultProvider="AspNetSqlMembershipProvider">
			<providers>
				<clear/>
				<add name="AspNetSqlMembershipProvider"
					 type="System.Web.Security.SqlMembershipProvider"
					 connectionStringName="connect"
					 enablePasswordRetrieval="true"
					 minRequiredPasswordLength="5"
					 minRequiredNonalphanumericCharacters="0"
					 requiresQuestionAndAnswer="False"
					 passwordFormat="Clear"
					 applicationName="UniqueApplicationNameChangedForEEPost" />
			</providers>
		</membership>
		<profile defaultProvider="MyCustomProfileProvider">
			<providers>
				<clear/>
				<add name="MyCustomProfileProvider"
					 connectionStringName="connect"
					 type="Microsoft.SqlTableProfileProvider"
					 table="Member"
					 profileVersion="1"
					 applicationName="UniqueApplicationNameChangedForEEPost" />
			</providers>
			<properties>
				<add name="MemberId" type="int" defaultValue=" " customProviderData="MemberId;int" />
				<add name="MembershipTypeId" type="int" defaultValue=" " customProviderData="MembershipTypeId;int" />
				<add name="CountryId" type="int" defaultValue="" customProviderData="CountryId;int" />
				<add name="StateId" type="int" defaultValue="" customProviderData="StateId;int" />
				<add name="GenderId" type="int" defaultValue="" customProviderData="GenderId;int" />
				<add name="PaymentSubscriptionId" type="int" defaultValue="0" customProviderData="PaymentSubscriptionId;int" />
				<add name="Firstname" type="string" defaultValue=" " customProviderData="Firstname;nvarchar" />
				<add name="Surname" type="string" defaultValue=" " customProviderData="Surname;nvarchar" />
				<add name="EmailAddress" type="string" defaultValue=" " customProviderData="EmailAddress;nvarchar" />
				<add name="DateOfBirth" type="datetime" defaultValue=" " customProviderData="DateOfBirth;datetime" />
				<add name="ProfileImageLocation" type="string" defaultValue=" " customProviderData="ProfileImageLocation;nvarchar" />
				<add name="ZipCode" type="string" defaultValue=" " customProviderData="ZipCode;nvarchar" />
				<add name="LastUpdatedDate" type="datetime" defaultValue="[getdate()]" customProviderData="LastUpdatedDate;datetime" />
				<add name="CreatedDate" type="datetime" defaultValue="[getdate()]" customProviderData="CreatedDate;datetime" />
				<add name="IsActive" type="bool" defaultValue="[1]" customProviderData="IsActive;bit" />
			</properties>
		</profile>

Open in new window

ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Apologies for not following up guys.

Have not solved the problem - having to work on it part time.

I suspect the answer is in one of the posts above so going to assign points now and post back when problem is solved.
Avatar of avanceconsulting
avanceconsulting

WOW we've solved this..

For me the issue was because I was deleting the PrecompiledApp.config file
when I deployed the app. Apparently that file tells the .Net runtime that
the app is already compiled and not to recompile it again. Without the file
the runtime tries to compile the app again conflicts arise.

Once I put the file back in and redeployed everything worked fine.
Regards,
Karunaker
Thanks Karunaker - will give this a try as soon as we are back in the office. For now we are running off the uncompiled source which is working but not ideal.