Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Prepare Azure environments for new workloads—subscriptions, networking, identity, and landing zones
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
references/services/functions/templates/recipes/common/dotnet-entry-point.md
1# C# (.NET) Entry Point (DO NOT MODIFY)23The base Azure Functions template includes a properly configured `Program.cs` that should NOT be modified or replaced by recipes.45> ⛔ **CRITICAL**: Do NOT replace or modify `Program.cs` from the base template.67## Base Template Program.cs89The official `functions-quickstart-dotnet-azd` template uses:1011```csharp12using Microsoft.Azure.Functions.Worker;13using Microsoft.Extensions.DependencyInjection;14using Microsoft.Extensions.Hosting;1516var host = new HostBuilder()17.ConfigureFunctionsWebApplication() // ASP.NET Core integration18.ConfigureServices(services =>19{20services.AddApplicationInsightsTelemetryWorkerService();21services.ConfigureFunctionsApplicationInsights();22})23.Build();2425host.Run();26```2728## Why This Matters2930| Feature | ConfigureFunctionsWebApplication | ConfigureFunctionsWorkerDefaults |31|---------|----------------------------------|----------------------------------|32| ASP.NET Core integration | ✅ Yes | ❌ No |33| IActionResult return types | ✅ Yes | ❌ No |34| [FromBody] model binding | ✅ Yes | ❌ No |35| App Insights integration | ✅ Built-in | ❌ Manual setup |36| Modern HTTP handling | ✅ Yes | ⚠️ Limited |3738## What Recipes Should Provide3940Recipes only need to add:411. **Trigger function files** (`.cs` files with `[Function]` attributes)422. **Package references** (`.csproj` additions for extensions)433. **App settings** (connection strings, configuration)4445All triggers use attribute-based binding — no Program.cs modifications needed:46- `[HttpTrigger]`, `[TimerTrigger]`, `[CosmosDBTrigger]`47- `[ServiceBusTrigger]`, `[EventHubTrigger]`, `[BlobTrigger]`48- `[DurableClient]`, `[SqlTrigger]`4950## Common Mistake5152❌ **WRONG** — Recipe overwrites Program.cs with outdated version:53```csharp54var host = new HostBuilder()55.ConfigureFunctionsWorkerDefaults() // OLD PATTERN56.Build();57```5859✅ **CORRECT** — Recipe leaves Program.cs untouched, only adds function files.60