error creating the strong name assembly??

anand

Regular
Joined
Jan 29, 2003
Messages
76
Location
chicago
Hi Kunal
How are u doing??i have a small problem..pls help me..bcz almost i wasted a oneday time for this...still i am getting an error ..
pls give me a idea what apeps i have to follow to register my dll in GAC.....

i am getting the error
failure to attemp;attempt to register a assembly without string name



but i craeetd a strong name to my assembly...still its giving the above error...

pls give me a idea what steps i have to follow to register my dll in GAC...


assume that my application path is
c:\anand\appl1\appl3



pls let me know whats my mistake..i am doing like this

i craeted a component(componnet1.vb) and the code in that component is

Public Class Component1

Inherits System.ComponentModel.Component

#Region " Component Designer generated code "

Public Sub New(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

Public Function func1() As String

func1 = "this is func"

End Function

End Class





and the code in form is(form.vb)

Imports System.Runtime.InteropServices

Imports System.Data

Imports System.Data.OleDb

Imports System

Imports System.Reflection

'<Assembly: AssemblyKeyFileAttribute("c:\anand\appl1\appl3\comp1.snk")>

Public Class Form1

Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

Public Sub New()

MyBase.New()

'This call is required by the Windows Form Designer.

InitializeComponent()

'Add any initialization after the InitializeComponent() call

End Sub

'Form 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 Windows Form Designer

Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form Designer

'It can be modified using the Windows Form Designer.

'Do not modify it using the code editor.

<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

'

'Form1

'

Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)

Me.ClientSize = New System.Drawing.Size(292, 273)

Me.Name = "Form1"

Me.Text = "Form1"

End Sub

#End Region

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Dim obj1 As New Component1()

MessageBox.Show(obj1.func1)

End Sub

End Class

after that i created a component1.dll file

c:\anand\appl1\appl3>vbc component1.vb /t:library /r:system.dll /r:system.data.dll

now i have a dll component1.dll and i created a strong name to that
c:\anand\appl1\appl3>sn -k comp1.snk

and i add that comp1.snk to my application and i write the line of code <assembly: assemblykeyfile("comp1.snk")>

and built the application again




now i am doing like this

c:\anand\appl1\appl3>gacutil/i component1.dll

now i am getting the error
failure to attempt;attempt to add an assembly without strong name...

pls let me know my mistake and let me know what steps i have to follow ....

Lot of thanks
Anand
 
Did you not read what I told you in your other thread? I guess you can't have, because you aren't doing what I said. You need to add the following parameter to your command line to compile your component:

/keyfile:mykeyfile.sn

That compiles your strong name file (which you need to have generated first) in to your assembly. THEN you should be able to add it to the GAC.
 
Hi devil
I created the strong name like that...
its createing the strong name file...comp1.snk...
when iam trying to add my dll in GAC its giving the error...
can u pls tell me the exact step i have to follow after getting the strong name...

i got the snk file like this
c:\anand\appl1\appl3>sn - k /keyfile:comp1.snk
now i got the snk file for my component1.dll
i added that .snk file to my application and i write the line in assembly info file
<assembly:assemblykeyfile("c:\anand\appl1\appl3\comp1.snk")>

and i build the application again....its not giving any error..
can u pls tell me what i have to do now...

Thank you
Satya
 
hi devil
i am creating a dll like this..

c:\anand\appl1\appl3>vbc component1.vb /t:library /r:system.dll /r:system.data.dll

its created a component1.dll...

and i created a string name to that like this
c:\anand\appl1\appl3>sn -k /keypair:comp1.snk

its created a comp1.snk ..i added that file to my application ...
and i modified the assemblyinfo.vb file

now i am trying to register the dll to GAC..at this point i am getting error

c:\anand\appl1\appl3>gacutil/i component1.dll

the error is:
failure to attempt to add assembly to cache: attemt to add a assembly without a strong name...

can u pls tell me what are the correct steps i have to follow....

lot of thanks for ur time
Satya
 
This is the last time I'm going to tell you this. I've told you twice already. You need to add the /keyfile parameter to your command line.

Code:
vbc component1.vb /t:library /r:system.dll /r:system.data.dll /keyfile:mykeyfile.sn
 
Hi devil
Lot of thanks for ur time.....
now its not giving any error..
when i add the assembly using gacutil its displaying assembly added to cache....

but the problem is its not dispaying my assembly name in the assembly list........

my code in assembly info.vb file is


<Assembly: AssemblyTitle("gummadi assembly1")>
<Assembly: AssemblyDescription("component1 assembly")>
<Assembly: AssemblyCompany("GST")>
<Assembly: AssemblyProduct("")>
<Assembly: AssemblyCopyright("GST rights")>
<Assembly: AssemblyTrademark("Global")>
<Assembly: CLSCompliant(True)>
<Assembly: AssemblyKeyFile("c:\inetpub\wwwroot\appl3\comp1.snk")>


can u pls tell me whats my mistake....pls give me a idea what more i have to do to display my assembly in GAC...

i use the lines

c:\anand\appl1\appl3>vbc component1.vb /t:library /r:system.dll /r:system.data.dll /keyfile:comp1.sn

c:\anand\appl1\appl3>gacutil/i component1.dll



pls let me know my mistake
Thanks
Anand
 
Your line

<Assembly: AssemblyKeyFile("c:\inetpub\wwwroot\appl3\comp1.snk")>

is incorrect. You should not be specifying the full path of the key file. Instead, use this:

<Assembly: AssemblyKeyFile("comp1.snk")>

It will find it because the compiler will have embedded it.
 
Hi divil
Sorry to say that still the assembly is not listed in the cache..is there any way to list my dll in GAC...pls let me know...
lot of thanks for your time..
Anand
 
Back
Top