Corresponding dependencies (DLLs) are not copied when deployed using Visual Studio 2013

In one of the web applications that I am deploying, I refer to one of my class libraries (Core), which is involved in starting some process (in this case sending email using SendGrid).

When I deployed my webjobs manually (uploading a ZIP file), everything worked fine. I cleaned up the deployment and redeployed it using Visual Studio 2013 and the webjob started having problems. The main problem here is that it is looking for the SendGrid DLL that my main class library references and not my console application, and it does not limit it to throwing the following error:

"Unhandled exception: System.IO.FileLoadException: Failed to load file or assembly 'SendGrid .... Version = 4.5.0.0, Culture = neutral, PublicKeyToken = 30ad4fe6b2a6aeed' or one of its dependencies. Does not match the assembly reference (exception from HRESULT: 0x80131040) "

I FTP'd to the website and found that building SendGrid effectively is not where my WebJob is located.

My question is: is there a way to force these dependencies to be copied to the correct directory when deploying using VS 2013?

Thanks,

+3
source share
3 answers

I am a member of the team that placed the WebJobs tool in the Summer 2013 update, and I can report that we know about this issue and have checked the fix for the next update, which will be released soon. At the same time, a workaround is to set up assembly links for the required assemblies — only NuGet packages solve this problem — and republish . We actually use the NuGet package to execute our deployment logic for WebJobs in VS. After we release the update, we will also release NuGet (which is undergoing final testing now), so customers in the Summer and Fall updates will mitigate this problem.

+2
source

This seems to be a known bug from Microsoft and, unfortunately, they are not too eager to fix it. Possible solutions:

  • You can manually copy it over
  • Create a build event to copy it
  • It seems some people are lucky to add something like this var t = typeof(ThirdParty.SomeClass);
+1
source

Solved the problem by following these steps.

  • Install your reference assemblies "Copy Locally -> True"
  • Define vacation solutions
0
source

Source: https://habr.com/ru/post/975586/


All Articles