I have a small issue and I'm not sure if I added an Azure function project to my workspace/solution correctly. I have a solution, in it I have 4 projects, an API (DotNet Core), client (Angular), Core (class with models and interfaces), Infrastructure (EF, DB, services).
I wanted to add an Azure function project to this solution/workspace and I did so by creating a folder called 'Azure' as seen in green, then I clicked on my Azure Extention, then clicked 'Add New Project' and walked through the steps. It created it successfully and all the files are in the folder. I can run the function and receive messages in it! Good ok!
Here are my Azure function extension options
PROBLEM - Now when I go to debug the website application (Angular/.Net Core) and I start up the Angular server and then debug/launch, I should have the compiler build me a new API.DLL, but it doesn't! And I see a error message pop up showing this
I can see my tasks.json file has been modified.
Here is tasks.json before I added the Azure function. You can see build label for the API.csproj info
{
"version": "2.0.0",
"tasks": [{
"label": "build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/API/API.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "publish",
"command": "dotnet",
"type": "process",
"args": [
"publish",
"${workspaceFolder}/API/API.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "watch",
"command": "dotnet",
"type": "process",
"args": [
"watch",
"run",
"${workspaceFolder}/API/API.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
}
]
}
And here is tasks.json after I add the function project, where the build label for the DotNet Core API has been removed! Now only Azure Function data is in it.
{
"version": "2.0.0",
"tasks": [{
"label": "watch",
"command": "dotnet",
"type": "process",
"args": [
"watch",
"run",
"${workspaceFolder}/API/API.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "clean",
"command": "dotnet",
"args": [
"clean",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"type": "process",
"problemMatcher": "$msCompile",
"options": {
"cwd": "${workspaceFolder}/Azure/Functions"
}
},
{
"label": "build",
"command": "dotnet",
"args": [
"build",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"type": "process",
"dependsOn": "clean",
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": "$msCompile",
"options": {
"cwd": "${workspaceFolder}/Azure/Functions"
}
},
{
"label": "clean release",
"command": "dotnet",
"args": [
"clean",
"--configuration",
"Release",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"type": "process",
"problemMatcher": "$msCompile",
"options": {
"cwd": "${workspaceFolder}/Azure/Functions"
}
},
{
"label": "publish",
"command": "dotnet",
"args": [
"publish",
"--configuration",
"Release",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"type": "process",
"dependsOn": "clean release",
"problemMatcher": "$msCompile",
"options": {
"cwd": "${workspaceFolder}/Azure/Functions"
}
},
{
"type": "func",
"dependsOn": "build",
"options": {
"cwd": "${workspaceFolder}/Azure/Functions/bin/Debug/net5.0"
},
"command": "host start",
"isBackground": true,
"problemMatcher": "$func-dotnet-watch"
}
]
}
FYI It looks like my tasks.json file is all tweaked up and modified! It looks like the dotnet build propoerties have been overwritten by the Azure function properties. If I copy and paste back in the old tasks.json file, it works fine. Should the addition of this new Azure function project have removed all my properties for the other parts of the app?
QUESTION - It seems like this isn't the best way to add an Azure Function Project to an existing workspace/solution. So what is the prescribed way and is there a tutorial or link somewhere I can follow as everything on the Microsoft site just shows new standalone function projects by themselves.


