Skip to content

Type exclusions

Exclusions apply to command/query descriptor types, transitively collected models, and library-mode types. They control generation, not backend authorization or endpoint exposure. Ensure remaining proxies do not reference an excluded type without a suitable replacement mapping.

Place this fragment inside your existing project’s Project element:

<ItemGroup>
<ExcludeType Include="secret-payload" TypeName="MyApp.Internal.SecretPayload" />
<ExcludeType Include="infrastructure-context" TypeName="MyApp.Infrastructure.InfrastructureContext" />
</ItemGroup>

Include supplies the MSBuild item identity. TypeName supplies the fully qualified C# type name the generator matches. Query exclusion is based on the descriptor’s owning type, not an individual method name.

You can combine type exclusions and namespace patterns in the same item group:

<ItemGroup>
<ExcludeType Include="internal-token" TypeName="MyApp.Auth.InternalToken" />
<ExcludeNamespace Include="internal" Namespace="MyApp.Internal*" />
<ExcludeNamespace Include="tests" Namespace="MyApp.Tests*" />
</ItemGroup>

The generator reads Namespace metadata, not the Include identity.

PatternMatches
MyApp.Internal*Any namespace starting with MyApp.Internal
MyApp.*.InternalNamespaces such as MyApp.Foo.Internal or MyApp.Foo.Bar.Internal
MyApp.InternalThe exact namespace only

* matches any sequence of characters, including dots. Be deliberate: MyApp.Internal* also matches MyApp.InternalTools.

With the executable alias prerequisite, use repeatable flags. Quote wildcards so the shell does not expand them:

Terminal window
proxygenerator assembly.dll output-path --skip-output-deletion \
--exclude-type=MyApp.Internal.SecretPayload \
'--exclude-namespace=MyApp.Tests*'