views:

2490

answers:

6

I have a project I made in Visual Basic 2008 Express. I converted it from someone else's C# project, but it works. It has several DLL dependencies. I went to publish my project so I can install it on another machine and for each DLL, I get an error: "Assembly must be strong signed in order to be marked as a prerequisite." I've done some research, but am not finding a lot and what I have found I don't really understand. What does this error mean? What is the best way to resolve it? One other thing: it took me a LONG time to be able to get all my dll's to reference correctly, so I prefer that the solution has NOTHING to do with moving DLL's around because that will likely break the functionality in my main project.

+10  A: 

If you're publishing via ClickOnce, go to the publish page and click on "Application Files". From there you should see a list of your DLL's. Ensure that the ones that are giving you trouble have their Publish Status marked as "Include" rather than "Prerequisite".

What this error message means is that the current publishing settings are going to expect all of the assemblies in question to be present in the Global Assembly Cache on the target machine before installation can take place. Since all assemblies in the GAC must be strong signed, any assembly marked as a prerequisite that isn't strong signed will give you this error.

Adam Robinson
This appeared to fix it.
Jason Shoulders
+1 for solving my similar problem in layman's terms.
Joey
Sounds good, but I can't find the publish page or "Application Files." How do I get there?
Dennis Palmer
Right click on the project, select "Properties".
Adam Robinson
I've looked at every tab and clicked every button in Properties and can't find it. My Publish page has location combo box, language drop down, version number and 3 buttons -- Prerequisites, Updates and "Publish Now." Prerequisites are things like .NET 3.5. Doesn't list any of my dlls.
Dennis Palmer
+1  A: 

Check this link out...it has instructions for signing your assembly with a strong name:

MSDN: Signing an Assembly with a Strong Name

Justin Niessner
Actually, I came across that page during my research before I answered and it was one of the pages I didn't understand.
Jason Shoulders
+2  A: 

Strongly named assemblies are mainly assemblies which have are signed by a cryptographic key. This is fairly easy to do with Visual Studio and does not require re-ordering of your dependencies.

I'm using non-express Visual Studio so the steps may be slightly different for you.

  • Right click on the project and select properties
  • Click on the Signing tab
  • Check "Sign the assembly"
  • In the combo box select "<New...>"
  • Complete the wizard
  • Rebuild
JaredPar
I did that once and it seemed to help a little. But, then it gave an error about another dependency. I forgot the exact wording, but I did "<New...>" again and browsed for that dependency and now I get an error: "Error creating assembly manifest: Bad version of provider".
Jason Shoulders
@Jason where do you see that message? Is it a dialog box or a build error?
JaredPar
It was a build error in the Error tab @ the bottom. I think browsing for that dependency wasn't the right thing to do and now I can't get rid of the reference.
Jason Shoulders
+1  A: 

To create a strong name just go to the SDK Command Prompt or Visual Studio 200X Command Prompt then type in the following

sn -k sgKey.snk

Refer this link for details

Then associate the strong name to your assembly by running the below command

al /out:MyAssembly.dll MyOldAssembly.dll /keyfile:sgKey.snk

Refer this link for details

Binoj Antony
A: 

what also helps:check that the Target Framework is actually set to 3.5 or whatever. Sometimes, it is not set.

helper
A: 

This just worked for me after the above mentioned solutions failed:

Remove the reference to the assembly in error, then add it again.

ahosie