thatsIT
thatsIT

Reputation: 2175

Compile error: CS0433 type in conflict with imported type

Never had this error before. I've read alot about it and I assume it is some references in my soultion that makes the conflicts. But I cant find it. There is no reference that have the name of "WeekOverview". Only finds it in App_Code folder.

Tried to clean, rebuild, batch and everything. But as I said I think it is a reference. But how will I get the right one?

Error when i published

CS0433: The type 'WeekOverview' exists in both 
'c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\personalwebb\75767f9d\62ef58be\assembly\dl3\b22616ea\c17e3cb3_f0ddcd01\App_Web_tzf1insv.DLL' and 
'c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\personalwebb\75767f9d\62ef58be\assembly\dl3\26ecbd1c\01966db2_f0ddcd01\App_Code.DLL'

Warning in visual studios

The type 'WeekOverview' in 'c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\website\ea888009\78e5b795\App_Web_jmrhajtx.5.cs' 
conflicts with the imported type 'WeekOverview' in 
'c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\website\ea888009\78e5b795\App_Code.cmrt8ckb.dll'. 
Using the type defined in 
'c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\website\ea888009\78e5b795\App_Web_jmrhajtx.5.cs'. c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\website\ea888009\78e5b795\App_Web_jmrhajtx.4.**cs

Edit

My problem were that I had on WeekOverview in App_Code and one .aspx page named WeekOverview. To soulve this I either had to get a namespace around my WeekOverview class. Or change the name on the class. Both worked and I made a namespace around it!

Upvotes: 7

Views: 3302

Answers (2)

Bex
Bex

Reputation: 4918

If this has just come out of nowhere try deleting your temporary asp.net files in the .net framework folder. If it comes back then you have a referencing problem.

Upvotes: 3

Grant Thomas
Grant Thomas

Reputation: 45083

I reckon you have a source file in the App_Code special folder, and some in-page code-behind where the same type (WeekOVervew) is defined. If these types do different things then they should be named aptly, resolving the error, if these types do the same thing then you should only have one copy, also resolving the error.

Remove or correct the duplicate type.

Upvotes: 3

Related Questions