1

We have an Azure function which references an external assembly via a private Nuget feed.

The problem we're having is that we have two different versions of Microsoft.Azure.WebJobs.dll - one which is a dependency of our nuget package and another which I'm assuming is being provided by the runtime.

 error CS1503: Argument 2: cannot convert from 'Microsoft.Azure.WebJobs.ICollector<Microsoft.WindowsAzure.Storage.Table.ITableEntity> [D:\Program Files (x86)\SiteExtensions\Functions\1.0.10635\bin\Microsoft.Azure.WebJobs.dll]' to 'Microsoft.Azure.WebJobs.ICollector<Microsoft.WindowsAzure.Storage.Table.ITableEntity> 

I found this question which says that binding redirects are not supported:

Azure Functions binding redirect

We could try to remove our dependency on that library, or we could match the version used by Azure Functions, but I think we're going to have the same problem with using Microsoft.WindowsAzure.Storage anyway.

Please advise!

Janusz Nowak
  • 2,595
  • 1
  • 17
  • 36
Nosmadas
  • 632
  • 3
  • 9
  • 17

1 Answers1

2

You are correct that binding redirects are not supported. The runtime has its own dependencies on the WebJobs SDK and Storage libraries so objects passed into your functions will be from those versions. I recommend removing your dependencies on other versions and snapping to ours. Note that for these libraries, you don't have to add your own package reference, you can reference ours in your function code via:

#r "WindowsAzure.Storage"

You don't need to add explicit #r references for WebJobs SDK types (e.g. ICollector<T>) - the runtime adds that assembly implicitly. Of course this only applies for function code we're compiling for you, not code coming from your external packages.

In the future we might improve things in this area, but for now you'll be swimming up stream if you try to use conflicting versions.

mathewc
  • 13,312
  • 2
  • 45
  • 53
  • 1
    Interesting but still begs the question why we cant pull that version from nuget. – davidcarr Nov 25 '16 at 18:04
  • You can pull the package from nuget, if you use the same (or compatible) version we're using. – mathewc Nov 26 '16 at 16:28
  • This was our silly mistake, we mistook the version of the functions runtime as the version of the Webjobs dll. Running 2.0.0 - it behaves correctly. We've since removed our dependencies on those packages though so either way it is fine. Thanks for all of your help! – Nosmadas Nov 27 '16 at 10:19