Edit

AZFW0109: Generated project should not be built

Item Value
Rule ID AZFW0109
Category Sdk
Severity Warning

Cause

The Build target is being run on the generated azure_functions.g.csproj project. This project is not intended to be built directly, instead it is used only to restore & resolve the extension payload.

Rule Description

The generated project is not intended to be built directly, instead it is used only to restore & resolve the extension payload. Building will result in a warning.

How to Fix

Diagnose what is causing the generated project (azure_functions.g.csproj) to be directly built. A common cause is a traversal or dirs.proj file that uses globbing to discover projects, which unintentionally captures the generated project. MSBuild binary log can be helpful in identifying why/how azure_functions.g.csproj is being built.

Exclude from a ProjectReference glob

If your traversal project uses a glob pattern to include projects, add an Exclude to skip the generated file:

<ItemGroup>
  <ProjectReference Include="**/*.csproj" Exclude="**/azure_functions.g.csproj" />
</ItemGroup>

Remove a specific ProjectReference

If the generated project was added as an explicit reference, remove the ProjectReference entry pointing to it:

  <ItemGroup>
-   <ProjectReference Include="path/to/azure_functions.g.csproj" />
  </ItemGroup>

Remove matching ProjectReference items conditionally

If you cannot easily modify the glob or the explicit include, you can remove matching items after they have been resolved:

<ItemGroup>
  <ProjectReference Remove="@(ProjectReference)" Condition="'%(Filename)%(Extension)' == 'azure_functions.g.csproj'" />
</ItemGroup>

When to Suppress Warnings

Suppression is not recommended. It is recommended to identify what is causing this project to be built and prevent it.