Could not load file or assembly 'AssemblyName PublicKeyToken=null' or one of its dependencies

瘦欲@ 提交于 2019-11-28 10:55:13

PublicKeyToken = null tells you that the CLR is looking for the unsigned assembly. Since you signed them, that's not going to work well and this kaboom is expected.

You will have to rebuild the program so it uses the updated signed assembly and embeds the non-null PublicKeyToken into the manifest. You may have to remove the existing assembly reference and add it back, it isn't clear from the question whether you built the program using an unsigned copy.

Use the Fuslogvw.exe utility if you still have trouble.

Maybe one of your "unsigned third-party assemblies" has a reference to another one of your "unsigned third-party assemblies" - so the reference is wrong after you signed them all.

Maybe this tool can help you: https://github.com/brutaldev/StrongNameSigner - it can update the assemblies (it probably also can done by using the command line, but I don't know how).

tomt
  1. backup all the production dll and files to another folder - just in case to rollback
  2. copy all the production dlls that the current process is running to your local project
  3. reference all these dlls on all the related local projects.
  4. Compile and copy the project dlls out again to try starting the window services.

still not working yet.

  1. backup all the production dll and files to another folder - just in case to rollback
  2. Copy all the new compiled dlls from the local projects and over-ride the dlls to the production folder
  3. start up the window service

I noticed you did say you signed the 3rd party libraries, but don't forget to also sign your own assemblies that use the 3rd party libs as well. Most importantly would be the assembly using the signed libs. This was how I recently fixed this issue for myself.

Visual studio is sometimes overly forgiving and allows us to get away with more than we should. Other times? Not so much.

Be sure to clean your project after making the changes as well. Then rebuild the solution. Hopefully that will get you a step further.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!