Solved

Create a Strong Name for Assembly

Posted on 2007-11-28
5
1,266 Views
Last Modified: 2013-11-26
I am having troubles with this error:
Unable to emit assembly: Referenced assembly 'CalendarLibrary' does not have a strong name.
I wasn't getting it while debugging before, but now that I tried to Publish, I'm getting it all the time.

A little background:
I'm using a CalendarLibrary.dll that was created from another project.  I put the CalendarLibrary.dll file in then bin/release folder of my current project and I'm referencing it there.  It works fine for debugging, but when I try to publish, I get the strong name error.

I've tried using - sn -k --.snk, created a keyfille, then tried tlbimp on CalendayLibrary.dll and it came up with an error saying CalendarLibrary.dll is not a valid type library.  (Also, no commands work in the command window of Visual Studio ???, so I'm doing this from the regular cmd prompt - I put the sn.exe, tblimp.exe, keyfile, and .dll all in the bin/release folder and running cmd prompt from that folder)

I've really been trying to solve this myself though looking at other solutions, msdn, etc. and I just can't figure it out.  If you have the info, please list step by step, 'cause I must be missing something.

Thanks
0
Comment
Question by:dreinmann
  • 3
  • 2
5 Comments
 
LVL 38

Accepted Solution

by:
PaulHews earned 500 total points
ID: 20366117
As you probably now know, any project that is signed cannot be dependent on assemblies that are not strong named.

To sign your CalendarLibrary, it's probably easiest to do it within Visual Studio.

Select your CalendarLibrary project in the Project Explorer and right click and select properties.

Click the "Signing" tab.

Check "Sign the assembly" box

In the key drop down, either select a previously generated key using browse or choose "<New...>"

Use Save All to ensure changes are saved.  Rebuild the project/solution.
0
 

Author Comment

by:dreinmann
ID: 20366336
Did that...makes sense.  But it won't let me Rebuld the Project.  A new error pops up:

The "GenerateResource" task failed unexpectedly.
System.Runtime.Serialization.SerializationException: Type 'CalendarLibrary.CalendarLibrary.CalendarItem' in Assembly 'CalendarLibrary, Version=1.0.0.0, Culture=neutral, PublicKeyToken=627e0898373e8271' is not marked as serializable.
   at Microsoft.Build.Shared.ExceptionHandling.RethrowUnlessFileIO(Exception e)
   at Microsoft.Build.Tasks.ProcessResourceFiles.ProcessFile(String inFile, String outFile)
   at Microsoft.Build.Tasks.ProcessResourceFiles.Run(TaskLoggingHelper log, ITaskItem[] assemblyFilesList, ArrayList inputs, ArrayList outputs, Boolean sourcePath, String language, String namespacename, String filename, String classname, Boolean publicClass)
   at Microsoft.Build.Tasks.GenerateResource.Execute()
   at Microsoft.Build.BuildEngine.TaskEngine.ExecuteTask(ExecutionMode howToExecuteTask, Hashtable projectItemsAvailableToTask, BuildPropertyGroup projectPropertiesAvailableToTask, Boolean& taskClassWasFound)      Demo

????
0
 
LVL 38

Expert Comment

by:PaulHews
ID: 20366486
It sounds like your application is supposed to serialize the class CalendarItem for remoting or xml or some other use.  You may have to mark it as serializable:

<Serializable()> _
Public Class CalendarItem  .... etc.
0
 

Author Comment

by:dreinmann
ID: 20366745
Actually, I went back to the original C# project (I was working on the one I converted to vb.net), signed it and rebuilt.  Recreated the CalendarLibrary.dll and put it in the bin/Release folder of the project I'm working on and I was able to Rebuild it successfully and Debug as well.  
But now a new error (I think I'm getting closer though):
SignTool reported an error 'Failed to sign bin\Release\Logistics Manager.publish\\setup.exe. SignTool Error: ISignedCode::Sign returned error: 0x80880253

      The signer's certificate is not valid for signing.

SignTool Error: An error occurred while attempting to sign: bin\Release\Logistics Manager.publish\\setup.exe

'.      LogisticsManager

What now...(by the way, you've answered my first question successfully, would you like me to award this question and start a new one for this new error?)
0
 

Author Comment

by:dreinmann
ID: 20367021
Got it!!  Had to do the 'install into Trusted Root Certificate' thing.

Thanks paulhews!
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
vb.net and creating a class 5 20
VB.net Progress Bar - Maximum Value too large 2 15
SSIS Start 2 21
Code enhancement 4 22
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

829 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