Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions sdk/Sdk/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Microsoft.Azure.Functions.Worker.Sdk

This package provides development-time support for Azure Functions .NET isolated worker apps, including MSBuild build and publish targets, a Roslyn source generator for function metadata, and analyzers.

## Getting Started

This package is typically added via the Azure Functions project template. To add it manually:

```dotnet
dotnet add package Microsoft.Azure.Functions.Worker.Sdk
```

For more information, see the [Azure Functions .NET isolated worker guide](https://learn.microsoft.com/azure/azure-functions/dotnet-isolated-process-guide).

## What's Included

### Build & Publish Targets

The SDK adds MSBuild targets that run during build and publish:

- **Function indexing** — Analyzes your compiled assembly and generates function metadata (`functions.metadata`) so the Azure Functions host can discover your functions without runtime reflection.
- **Extension bundling** — Auto-generates a `WorkerExtensions` project that compiles all binding extension packages into a single assembly.
- **Publish support** — Configures output for deployment, including Docker base image assignment for container scenarios.

### Source Generators

Three Roslyn source generators run at compile time:

- **FunctionMetadataProvider** — Generates a `IFunctionMetadataProvider` implementation that returns metadata for all `[Function]`-attributed methods. This enables build-time indexing for fast cold starts.
- **FunctionExecutor** — Generates strongly-typed wrapper methods for invoking user functions with correct parameter binding.
- **ExtensionStartupRunner** — Generates a startup orchestrator that calls `Configure()` on all extension startup types.

### Analyzers

| Diagnostic | Severity | Description |
|------------|----------|-------------|
| AZFW0001 | Error | WebJobs binding attributes (in-process) used instead of isolated worker attributes |
| AZFW0002 | Error | Async function method returns `void` instead of `Task` |
| AZFW0009 | Error | `SupportsDeferredBinding` applied to an output binding |
| AZFW0010 | Warning | Parameter type not supported by the binding attribute |
| AZFW0011 | Error | Blob container path requires an iterable type or `BlobContainerClient` |

Copy link
Copy Markdown

@Frulfump Frulfump Apr 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't AZFW0017 #3359 also be documented? (even the same author)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh good catch I looked at both independently, I will create a follow up pr tomorrow to adjust this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is covered here #3370 thanks @Frulfump for noticing this!

## Configuration

The SDK exposes MSBuild properties you can set in your `.csproj` to control its behavior:

```xml
<PropertyGroup>
<!-- Azure Functions runtime version (default: v4) -->
<AzureFunctionsVersion>v4</AzureFunctionsVersion>

<!-- Disable build-time function indexing (default: true) -->
<FunctionsEnableWorkerIndexing>true</FunctionsEnableWorkerIndexing>

<!-- Control metadata source generation independently (default: mirrors FunctionsEnableWorkerIndexing) -->
<FunctionsEnableMetadataSourceGen>true</FunctionsEnableMetadataSourceGen>

<!-- Control executor source generation independently (default: true) -->
<FunctionsEnableExecutorSourceGen>true</FunctionsEnableExecutorSourceGen>

<!-- Namespace for generated code (default: your project's RootNamespace) -->
<FunctionsGeneratedCodeNamespace>MyApp.Generated</FunctionsGeneratedCodeNamespace>
</PropertyGroup>
```
5 changes: 5 additions & 0 deletions sdk/Sdk/Sdk.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,13 @@
<IncludeBuildOutput>false</IncludeBuildOutput>
<FunctionsGeneratorOutputPath>..\FunctionMetadataLoaderExtension\bin\$(Configuration)\netstandard2.0\</FunctionsGeneratorOutputPath>
<NoWarn>$(NoWarn);NU5128</NoWarn>
<PackageReadmeFile>README.md</PackageReadmeFile>
</PropertyGroup>

<ItemGroup>
<Content Include="README.md" Pack="true" PackagePath="/" />
</ItemGroup>

<Import Project="..\..\build\Common.props" />

<ItemGroup>
Expand Down
Loading