奇怪的,无法加载文件或程序集,使用DocuSign时出现错误。

huangapple go评论70阅读模式
英文:

Weird Could not load file or assembly error using DocuSign

问题

I have a .net framework project with framework as 4.8. Recently I integrated docuSign 5.12 using a class library and nuget packages. Everything worked fine in development. When I published the exe in server, I am getting could not load file or assembly error. I cleared the references, reinstalled docusign, changed copy to output property to true for all and published again. But same result.

What I noticed is, when installing .net framework in server, it didn’t create a folder called .Netframework in ‘c:\Program Files(x86)\Reference Assemblies\Microsoft’. As the required dependencies missing are system dependencies, they are not copied to the published folder.

So, I have another server where .net 4.8 SDK is present and everything worked fine there. My questions are

  1. Why didn’t installation in server didn’t create assemblies?
  2. Do we need to install .net 4.8 SDK for this to work?
  3. How to publish dependencies for these kind of Nuget packages?

I have not added code samples as it is working already. Dependencies are https://www.nuget.org/packages/DocuSign.eSign.dll/5.12.0#dependencies-body-tab.

英文:

I have a .net framework project with framework as 4.8. Recently I integrated docuSign 5.12 using a class library and nuget packages. Everything worked fine in development. When I published the exe in server, I am getting could not load file or assembly error. I cleared the references, reinstalled docusign, changed copy to output property to true for all and published again. But same result.

What I noticed is, when installing .net framework in server, it didn’t create a folder called .Netframework in ‘c:\Program Files(x86)\Reference Assemblies\Microsoft’. As the required dependencies missing are system dependencies, they are not copied to published folder.

So, I have another server where .net 4.8 SDK is present and everything worked fine there. My questions are

  1. Why didn’t installation in server didn’t create assemblies?
  2. Do we need to install .net 4.8 SDK for this to work?
  3. How to publish dependencies for these kind of Nuget packages?

I have not added code samples as it is working already. Dependencies are https://www.nuget.org/packages/DocuSign.eSign.dll/5.12.0#dependencies-body-tab.

答案1

得分: 0

你可以使用VS的发布功能。它会打包你的应用程序,包括所有的NuGet dll文件及其依赖项,并将其发送到服务器。如果你使用Azure,它已经集成到这个过程中。你甚至可以将它包含在CI/CD过程中。但是,你的具体问题可以通过让VS将应用程序发布到服务器,而不是手动复制文件到那里来解决。

英文:

You can use the publish functionality of VS. It will package your app, including all NuGet dlls and their dependencies and send it to server. If you use Azure - it's integrated into the process. You can even include it in a CI/CD process. But your specific problem can be addressed by just having VS publish the app to your server instead of you manually copying files over there.

答案2

得分: 0

根据Ralf的评论,我检查了参考资料。发现了一个有趣的事情。我已经在项目中添加了一个绑定重定向,但它添加到了类库配置文件,而不是启动项目的配置文件。因此,我的API引用了旧的Newtonsoft版本。我将重定向从类库配置复制到我的主项目配置,然后它开始工作。

英文:

As per the comment from Ralf, I checked the references. Found an interesting thing. I already had a binding redirect in the project but, it was added to the class library config file but not the startup project config file. Because of that, my API was referring to old Newtonsoft version. I copied redirect from class library config to my main project config and it started working.

huangapple
  • 本文由 发表于 2023年2月7日 00:41:56
  • 转载请务必保留本文链接:https://go.coder-hub.com/75364169.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定