I have an Azure Function that connects to a database, but it's failing with the following message -
The type or namespace name 'Npgsql' could not be found (are you missing a using directive or an assembly reference?)
In project.json
, I have the following declaration -
{
"frameworks": {
"net46":{
"dependencies": {
"Npgsql": "3.2.2",
"System.Runtime.Serialization.Formatters": "4.3.0"
}
}
}
}
The strange thing is, I have the exact same Function (deployed from Octopus) running on another Function App (a lower environment) without issue.
Is anyone able to explain why my dependancies being ignored in one Function App but not the other?
So this seems that this is happening due to the way that the Function App is deployed. I'm using Octopus, deploying via the "Deploy an Azure Web App" process step, and it seems that all that's happeing is the old files are being deleted, and the updated files copied across.
The trouble is, as far as I can tell, the dependancies in
project.json
are not resolved unless you edit the file via the Portal and then save it.I'm not sure if this can be classed as a bug in either Octopus or Azure (or just really lazy implementation Function Apps), but it's very frustrating. Essentially it makes remote deployment of a Function App that includes changes to
function.json
impossible.