views:

259

answers:

2

I have a C# project in VS2005 that is referencing a few COM libraries. When I build it errors like this are thrown:

Referenced assembly 'assemblyName' does not have a strong name.

Now, I used to reference COM assemblies in VS2003 and it would automatically sign the Interop wrappers. All I had to do was set the setting 'Wrapper Assembly Key File'.

I tried finding a similar setting in VS2005, but couldn't find any. So I was wondering if there's any equivalent way of strong naming COM Interops in VS2005 and getting rid of the above error.

If anyone knows, please tell me.

Thanks.

A: 

It looks like it was already answered in "Where is the Wrapper Assembly Key File setting in VS 2008?" question.

Vadim
Yeah I could do that on the command line. But the COM library I'm referencing is in the same solution as the referencingin C# project. And yes, even in this case I could use the tlbimp as post or prebuild event. However, I was wondering if there is some simple UI setting in VS2005 as we used to have in VS2003.
Frederick
A: 

Instead of using Visual Studio you could use Tlbimp.exe and Aximp.exe to generate the Interops. Tlbimp.exe has options for signing.

I have used them to be generate an Interop file for each different version of the same COM component in my application. The COM components are vendor supplied COM components used for accessing data points in mass spectrometry files and the COM interface change from time to time as new versions of the vendor software is released. The application can then decide at runtime which Interop to use in order to match what version is installed on the computer where the application is installed. The BAT file I use for generating the Interops is online.

Peter Mortensen

related questions