Precompiled Azure Functions with Dependency Error
See original GitHub issueHi, Team.
I know how to use precompiled
Azure Functions by following the official document. It just works fine.
However, when I put the TraceWriter
instance like:
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using Microsoft.Azure.WebJobs.Host;
namespace PrecompiledLibraries
{
public class MyHttpTrigger
{
public static async Task<HttpResponseMessage> Run(HttpRequestMessage req, TraceWriter log)
{
log.Info($"C# HTTP trigger function processed a request. RequestUri={req.RequestUri}");
// parse query parameter
string name = req.GetQueryNameValuePairs()
.FirstOrDefault(q => string.Compare(q.Key, "name", true) == 0)
.Value;
// Get request body
dynamic data = await req.Content.ReadAsAsync<object>();
// Set name to query string or body data
name = name ?? data?.name;
return name == null
? req.CreateResponse(HttpStatusCode.BadRequest, "Please pass a name on the query string or in the request body")
: req.CreateResponse(HttpStatusCode.OK, "Hello " + name);
}
}
}
It throws an error like below:
The following 1 functions are in error:
HttpTriggerCSharp: Could not load file or assembly ‘Microsoft.Azure.WebJobs.Host, Version=1.1.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies. The system cannot find the file specified.
That library actually a dependency of Azure Functions and there’s no need to load.
Not sure this is a bug of either:
- Azure Functions itself,
- Azure Functions CLI,
- Visual Studio Tooling, or
- something else
Could you have a look into this, please?
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Precompiled Azure Function Dependency Error
This now works fine in Azure Functions. In short, look at the dependencies, isolate them in an assembly then include that in your...
Read more >Azure Functions v3 dependency injection issue
Hello, When trying to use DI with [FromServices], it fails with the following build error: Error Mono.Cecil.
Read more >Precompiled Azure Function Dependency Error
I fixed my problem by placing the code using the resource manager API into one assembly and just used that. This now works...
Read more >Azure function precompiled timerTrigger error
I have a timer trigger working on a precompiled function using a slightly different definition of the Run function. using System; using System.Collections....
Read more >Netwontsoft.Json dependency conflicts with Azure Functions ...
If you're encountering an error with Newtonsoft.Json dependency conflicts in Azure Functions (both .net Framework V1 or .
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
We have a couple of ideas to make that better than just relying on docs. One of them being a meta-package you can reference that would ensure you have the right dependencies.
Resolved