lounge56 Posted March 1, 2004 Posted March 1, 2004 Hello! I have an .aspx page where I register a simple Custom Control. When I run the C# version of the project in 2002 Visual Studio.NET IDE, I get: Compiler Error Message: CS1595: 'MyCustomControls.CustomControl1' is defined in multiple places; using definition from 'c:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files\aspnet21days_ch6_custommade1\d3785e63\d65d6407\assembly\dl2\616735d8\14e5d5fc_ceffc301\CustomControl.DLL' I rewrote the project in VB.NET and it worked fine. I think I heard there was some bug related to this with specifically C#. Anyone have any solutions to this problem? My project has to be done in C#. By the way, in both versions of the project, I am manuallly compiling the user control into MSIL DLL using the Command Prompt to the corresponding "/bin" directory in each project. Thank you! -ricardo Quote
*Gurus* Derek Stone Posted March 1, 2004 *Gurus* Posted March 1, 2004 The project most likely holds a reference to both the compiled assembly in the "Temporary ASP.NET Files" directory, and contains the source code to the control, which is compiled along with the rest of the project. Make sure to check for duplicate references, and delete copies of the assembly that are located outside of the application's "bin" directory. Quote Posting Guidelines
lounge56 Posted March 2, 2004 Author Posted March 2, 2004 RE: Custom Control Defined in Multiple Places Thank you! I checked my source code and there are copies of the assembly located outside the bin directory. Two questions: 1. Where do I check if there are multiple references to the custom control? the debug log shows only one reference to my Custom Control. This reference points to the copy created in the Temporary ASP.NET files. I checked the assembly info. file in this directory and it does reference the original copy of the Custom Control I compiled: [AssemblyInfo] MVID=a7929ddbc3855543a7cd8993dddf0303 URL=file:///c:/inetpub/wwwroot/ASPNET21Days/Ch6/CustomMade1/bin/CustomControl.DLL DisplayName=CustomControl, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null 2. When you say "The project ... contains the source code to the control, which is compiled along with the rest of the project...", do you mean that I have to create the custom control in a separate project (as opposed to when I build a working copy with VB.NET that includes the Custom Control .vb file)? Cheers! -ricardo 8~) Quote
*Gurus* Derek Stone Posted March 2, 2004 *Gurus* Posted March 2, 2004 If you're using a 3rd party control you need to first copy it to your application's "bin" directory and then reference it in your project. On the other hand, if you're compiling your own control to its own assembly and referencing it all within the same solution, then you should compile the control prior to working on the main project, an exclude the control project from the build. Of course you could instantiate the control from within the project and have the class included in the application's assembly. Quote Posting Guidelines
lounge56 Posted March 2, 2004 Author Posted March 2, 2004 That did it Derek! I excluded my Custom Control from the Project Build and it then ran fine. I guess it's one of those things that tolerant VB.NET forgives while C# does not. Thank you very much for your help! -ricardo Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.