Errors in generated ASP .NET Temporary files

  • Thread starter Thread starter j
  • Start date Start date
J

j

I am getting this error when trying to compile code generated using
xsd.exe:
The type 'TrailerList' already contains a definition for
'rCMSTrailerListRow' c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary
ASP.NET Files\photoblobws\4e7bb29f\6f50d4db\App_Code.vnsjeqin.4.cs

What could cause this error in a generated file? What should I look for
in the code file to fix it?
 
Usually, that error means that the type is already defined in an assembly
somewhere in the project. The easiest way to eliminate this is to do a
search of your project for that type. You should have only one definition.
 
Hi,

Usually, that error means that the type is already defined in an assembly
somewhere in the project. The easiest way to eliminate this is to do a
search of your project for that type. You should have only one definition.

(could you set your newsreader to insert the signature after the quote?
Or post your reply after the quote? With the current settings, I have to
manually copy/paste the OP's reply. Thanks!)

Actually, this error is not what you describe. In ASP.NET, this error
occurs when the same control is declared twice. This often occurs in
ASP.NET 2.0 because the controls found in the ASPX page are
automatically declared in a partial class contained in the file
<pagename>.aspx.designer.cs. If the OP declared the control in the
<pagename>.aspx.cs page (as it was done in ASP.NET 1.1), the compiler
will throw this error.

The solution is to simply remove the control's declaration (protected
ControlType controlName) from the aspx.cs page.

To the OP: ASP.NET related questions are better at home in
microsoft.public.dotnet.framework.aspnet

HTH,
Laurent
 
Back
Top