1
votes

I have a custom DLL which depends on packages in project.json. I am getting the following error:

2017-05-25T21:04:18.152 Exception while executing function:
Functions.TimerTriggerCSharp1. mscorlib: Exception has been thrown by the target of an invocation. f-TimerTriggerCSharp1__631134587: Could not load file or assembly 'MyAssemblyName, Version=MyAssemblyVersion, Culture=neutral, PublicKeyToken=MyAssemblyToken' or one of its dependencies. The system cannot find the file specified.

I've added the assembly in the bin/ folder and am referencing it with the full path. The assembly depends on other Nuget packages that I defined in project.json.

Any idea why I'm getting the error?

1
I asked a similar question recently. See if the info there helps you (and in the resulting GitHub thread): stackoverflow.com/questions/42478305/…Jaxidian

1 Answers

0
votes

The general guidance/recommendation is to deploy your transient dependencies with your assemblies.

In the case of NuGet dependencies, the runtime will resolve that for you, but the runtime will attempt to fulfill those dependencies, but please make sure you change your assembly reference from using the full path to using the simple file name (without the path) only, like: #r "MyAssembly.dll"

The runtime will automatically load the assembly from the bin folder as a private dependency, which will scope the dependency to that function and attempt to use the function's referenced packages to fulfill transient dependencies.