Solved

Strong Name error building assembly

Posted on 2004-04-29
10
1,076 Views
Last Modified: 2012-06-27
I generated a strong name key file using the sn.exe tool, and assigned the key file to my VB.NET assembly.  But when I build the assembly I receive an error saying "Unable to emit assembly: Referenced assembly 'Interop.FooBar' does not have a strong name".  FooBar is a vendor COM component.  How can I get past this error?

0
Comment
Question by:d532335
  • 4
  • 3
10 Comments
 
LVL 5

Expert Comment

by:tgannetts
ID: 10949725
The Interop assembly the IDE generates for the COM component is not strongly named. You need to generate an Interop assembly with a strong name:

You can use the tlbimp.exe utility to generate a strongly-named Interop assembly from the Foobar dll using a strong name key file you have generated:

From the Visual Studio command line prompt:

tlbimp FooBar.dll /keyfile:FooBar.snk /out:interop.foobar.dll /namespace:foobar

This should create a strongly-named interop assembly which you can reference instead of the one the IDE generates for you. This should get rid of your problem.

Hope this helps

Tom
0
 

Author Comment

by:d532335
ID: 10951324
When I used the tlbimp on the dll it gave me an error saying that it wasn't a valid type library.  I instead used the tlb file.  This appeared to work, but I received several errors all similar to the following


TlbImp warning: At least one of the arguments for '_IOraBindVariable.GetPersistentPointer' can not be marshaled by the runtime marshaler.  Such arguments will therefore be passed as a pointer and may require unsafe code to manipulate.


I am in the process of testing.  Thought I would get your opinion.
0
 

Author Comment

by:d532335
ID: 10977210
I have an ocx that I add as a reference, which creates an interop dll under the obj directory.  No problem up to now because I can run the tlbimp that you suggested.  But when I goto the Customize toolbox and add the same control so that I can drop it on my form, it creates another dll under the obj directory called AxInterop.XXX.dll.  Therfore now I have two Interop dlls created from the same ocx.  One is called AxInterop.xxx.dll and the other is called Interop.xxx.dll.  How do I give both of these a strong name?
0
 

Author Comment

by:d532335
ID: 10977217
Since I have asked multiple question on this thread, I was going to increase the point value, which use to be obvious.  How do you add points to a question now?
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 96

Expert Comment

by:Bob Learned
ID: 11123175
Are you still having a problem with this?

Bob
0
 

Author Comment

by:d532335
ID: 11127079
Yes I never received any postings on my follow-up issue
0
 
LVL 96

Accepted Solution

by:
Bob Learned earned 500 total points
ID: 11127101
You only need the one interoperability library.  When you created the AxInterop library, it was similar to using tlbimp.  You should probably keep the AxInterop reference.

Bob
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 11177025
Did this help you?

Bob
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Word Template Mail merge with vb.net 4 57
Code enhancement 5 22
Change data in datatable 8 30
Help with AsEnumerable(), LINQ 4 22
Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now