4

This article describes how to run your Azure Function code through VS 2015.

How can I include project dependencies from within the same solution into this function? And without having to publish them to NuGet.

I've tried adding the reference to project.json:

{
  "dependencies": {
    "MyProject": "*"
  },
  "frameworks": {
    "net46": {
    }
  }
}

And including it in run.csx:

using System;
using MyProject;

public static void Run(BrokeredMessage message, TraceWriter log)
{
     ...
}

But I get the typical complication error:

run.csx(2,7): error CS0246: The type or namespace name 'MyProject' could not be found (are you missing a using directive or an assembly reference?)

Dave New
  • 38,496
  • 59
  • 215
  • 394

1 Answers1

2

Project references are not really supported with the current VS Tooling. This is a major focus for the next iteration of the tool. You can follow the issue tracking this here.

There are some hacky workarounds to make it work, but given the improvements we're expecting to make, I wouldn't recommend them.

The GitHub issue I've linked to does provide a workaround you can use in the meantime, using build actions and dropping the output into the appropriate location so functions can reference them. This is not optimal, and as mentioned above, something the team is working to address as soon as possible.

Fabio Cavalcante
  • 12,328
  • 3
  • 35
  • 43