Strong Signed Assemblies
Asked Answered
I

10

27

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.

Indemnify answered 6/4, 2009 at 13:1 Comment(0)
H
50

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.

Headstall answered 6/4, 2009 at 13:5 Comment(8)
Sounds good, but I can't find the publish page or "Application Files." How do I get there?Prothallus
Right click on the project, select "Properties".Headstall
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.Prothallus
+1 solved similar problem with c# project (windows service) in VS 2005 that included an installer component - actually the error appeared at compile time without myself touching or thinking about any "publishing" settings in application properties...Monkfish
I voted this up too soon. I changed all the settings to Include, and I'm still getting this issue on two of my assemblies.Tricorn
@David: Are the assemblies in question (and the right versions) listed in the prerequisites?Headstall
+1 - it wasn't exactly my problem, but your follow-up explanation did open a few doors that led to my solution. Exactly what I was looking for!Koala
If this doesn't work for you: Be sure that all of your assemblies are included in the Release build! Especially when targeting a specific platform, some of your included assemblies might not actually be checked in the Configuration Manager. Dumb, but it got me the rest of the way.Simmer
D
6

The workaround is more simple than that:

  1. Go to your project.
  2. Right click and Select Properties.
  3. Go to the Security Tab.
  4. Uncheck Enable ClickOnce security Settings.

Unless you are deploying this application through ClickOnce, you don't need to StrongName your assemblies.

Dowser answered 23/8, 2012 at 14:15 Comment(0)
K
4

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
Kent answered 6/4, 2009 at 13:7 Comment(3)
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".Indemnify
@Jason where do you see that message? Is it a dialog box or a build error?Kent
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.Indemnify
L
3

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

MSDN: Signing an Assembly with a Strong Name

Loiretcher answered 6/4, 2009 at 13:6 Comment(1)
Actually, I came across that page during my research before I answered and it was one of the pages I didn't understand.Indemnify
E
2

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

Earthshaker answered 6/4, 2009 at 13:9 Comment(0)
S
1

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

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

Sod answered 9/7, 2010 at 10:0 Comment(0)
O
0

Check that the Target Framework is actually set to 3.5 or whatever framework you want to target. Sometimes it will error out when it's not set properly.

Orrery answered 30/6, 2010 at 17:1 Comment(0)
P
0

I found my problem to be in the .csproj file

<Reference Include="OtherProjectNothingToDo">
  <HintPath>..\..\..\..\Pedidos\XBAP\Pedidos\Pedidos\bin\Release\Pedidos.exe</HintPath>
</Reference>

Then I removed it using notepad and it is okay now.

Parietal answered 9/12, 2011 at 23:35 Comment(0)
L
0

Using Adam Robinson's solution allowed me to publish, but I found that users could not install the project once it was published, as the end user system would complain of an inability to install, noting hard drive space. As this seemed highly unlikely to be the root cause, I looked further into it.

Apparently the basis for my problem was that one of my references was also referencing a .dll that my project used, but a different version. ClickOnce was not having this, and refused to copy the second version of the .dll to the user's system, citing the version already present. Fixing it so the .dll and the project referenced the same version of the other .dll removed the error and corrected the install problem.

Leviticus answered 10/11, 2012 at 0:5 Comment(0)
D
0

I just had this problem too. In my case the blabla.dll was referenced in my solution but blabla.dll was also used in another.dll which i had referenced in my project.

On checking the versions of both blabla.dll they were not the same. So i updated another.dll with the correct blabla.dll and then referenced the new another.dll in my solution. The error was gone.

In short: i was using 2 versions of blabla.dll

I hope this makes sense, if not let me know. :)

Check my blog for more detailed explanation: Blog article

Regards, Jacob Iedema

Dishearten answered 7/10, 2013 at 13:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.