强烈命名一个第三方组件 - 无法加载文件或程序第三方、组件、加载、强烈

2023-09-04 01:15:08 作者:别再计较

我写一个Visual Studio 2012的扩展,供内部使用,它要求所有程序集具有强名称。我很依赖RestSharp(和一些其他DLL),并且因为它不是强命名,我加入一个强大的名字给它下的this.根据进程的输出一切正常,甚至视觉工作室声称它是强命名,如果我看RestSharp.dll在项目引用的属性。然而,当我去使用我的分机我得到一个FileLoadException声称:

I am writing a Visual Studio 2012 extension, for internal use, which requires that all assemblies have a strong name. I am dependent on RestSharp (and a few other dlls), and since it is not strongly named, I am adding a strong name to it by following this. Everything works according to the output of the process, and even visual studio claims it is strongly named if I look at the properties of RestSharp.dll in the project references. However, when I go to use my extension I get a FileLoadException claiming:

Could not load file or assembly 'RestSharp, Version=104.1.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. A strongly-named assembly is required. (Exception from HRESULT: 0x80131044)

在如何解决这个或解决它有什么想法?

Any thoughts on how to resolve this or work around it?

推荐答案

我写了一个解决方案的NuGet级封装,以帮助强命名的第三方组件用自己的密钥。

I wrote a NuGet solution level package to help with strong naming 3rd party assemblies with your own key.

这是针对签约的NuGet包的内容   使用无符号组件,以便能够链接到这些   包,其中消费项目的强命名。访问   原始来源$ C ​​$ C不是必需的,你可能会签署任何集会   用自己的强命名关键。您也可以推迟签收,如果需要的。

This is targeted for signing the contents of NuGet packages that are using unsigned assemblies, in order to be able to link to these packages where the consuming project is strongly named. Access to the original source code is not required, and you may sign any assembly with your own strong naming key. You may also delay-sign if desired.

https://nuget.org/packages/Nivot.StrongNaming

您可以阅读更多关于它在我的博客:

You can read more about it on my blog:

的http://www.nivot.org/blog/post/2013/04/30/Signing-unsigned-assemblies-in-NuGet-packages