anand Posted March 19, 2003 Posted March 19, 2003 (edited) Hi friends i am getting an error while creating the .dll for a component in vb.net.... the error is Inherits System.ComponentModel.icontainer is not defined... my code is: Imports System Imports System.Data Imports System.ComponentModel.Component Public Class Component1 Inherits System.ComponentModel.Component Public Function func() As String func = "func from component1" End Function #Region " Component Designer generated code " Public Sub New(ByVal Container As System.ComponentModel.IContainer) MyClass.New() 'Required for Windows.Forms Class Composition Designer support Container.Add(Me) End Sub Public Sub New() MyBase.New() 'This call is required by the Component Designer. InitializeComponent() 'Add any initialization after the InitializeComponent() call End Sub 'Component overrides dispose to clean up the component list. Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) If disposing Then If Not (components Is Nothing) Then components.Dispose() End If End If MyBase.Dispose(disposing) End Sub 'Required by the Component Designer Private components As System.ComponentModel.IContainer 'NOTE: The following procedure is required by the Component Designer 'It can be modified using the Component Designer. 'Do not modify it using the code editor. <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() components = New System.ComponentModel.Container() End Sub #End Region End Class pls give me a idea whats my mistake and let me know how to craete a .dll for component..... Thank you Satya Edited March 19, 2003 by divil Quote Satya
*Gurus* divil Posted March 19, 2003 *Gurus* Posted March 19, 2003 This line: Imports System.ComponentModel.Component Should not be there. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
anand Posted March 19, 2003 Author Posted March 19, 2003 Hi devil I remove that line still i am getting the same error....pls tell me can i create a dll for component...whats the diff between class and component in .net.....why its giving an error while creating the dll for component... i am creating the dll like this c:\anand\appl1\appl1>vbc /t:library c:\anand\appl1\appl1\component1.vb pls give me idea what to do... Thank you Anand Quote Satya
*Gurus* divil Posted March 20, 2003 *Gurus* Posted March 20, 2003 Can you post the exact error text, including the line it occurs on, please? Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
anand Posted March 20, 2003 Author Posted March 20, 2003 Inherits System.ComponentModel.Component ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ c:\anand\appl1\appl1\Component1.vb(15) : error BC30002: Type 'System.ComponentMo del.IContainer' is not defined. Public Sub New(ByVal Container As System.ComponentModel.IContainer) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ c:\anand\appl1\appl1\Component1.vb(33) : error BC30284: sub 'Dispose' cannot be declared 'Overrides' because it does not override a sub in a base class. Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) ~~~~~~~ c:\anand\appl1\appl1\Component1.vb(43) : error BC30002: Type 'System.ComponentMo del.IContainer' is not defined. Private components As System.ComponentModel.IContainer ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ c:\anand\appl1\appl1\Component1.vb(49) : error BC30002: Type 'System.ComponentMo del.Container' is not defined. components = New System.ComponentModel.Container() ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C:\ANAND\APPL1\APPL1> Quote Satya
*Gurus* divil Posted March 20, 2003 *Gurus* Posted March 20, 2003 You need to tell the compiler that you're referencing the System.dll and System.Data.dll assemblies: C:\>vbc /target:library component1.vb /reference:System.dll /reference:System.Data.dll Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
anand Posted March 20, 2003 Author Posted March 20, 2003 Hi divil Lot of thanks .....its working fine now...it creates a .dll now for component..... lot of thanks for ur time Satya... Quote Satya
anand Posted March 20, 2003 Author Posted March 20, 2003 Hi Divil I Have a small doubt now.. i created a .dll for a component and i created a strong name for that(comp1.snk) and i add that .snk file to my application ..and i write the line <assembly:assemblykeyfile("comp1.snk")> i biuld my application..it didnt give any error.............. but when i am trying to add that .dll into global assembly cache its giving the error C:\ANAND\DLLS>gacutil /i comp1.dll Microsoft ® .NET Global Assembly Cache Utility. Version 1.0.3705.0 Copyright © Microsoft Corporation 1998-2001. All rights reserved. Failure adding assembly to the cache: Attempt to install an assembly without a strong name pls give me a idea how to add my dll to GAC... Thank you satya Quote Satya
*Gurus* divil Posted March 21, 2003 *Gurus* Posted March 21, 2003 To give your assembly a strong name, you need to use the /keyfile:mykeyfile.sn parameter. This is all in the Framework SDK documentation. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
anand Posted March 21, 2003 Author Posted March 21, 2003 hi divil already i ceated a strong name to my assembly...i want to register that in global assembly cache...pls give me a idea how to do that... Thank you Satya Quote Satya
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.