2

I am trying to upgrade to .NET 10 (from .NET 9), but after updating the Microsoft.AspNetCore.OpenApi package to 10.0.0, I can no longer build my application.

This is the error I get:

The 'interceptors' feature is not enabled in this namespace. Add '$(InterceptorsNamespaces);Microsoft.AspNetCore.OpenApi.Generated' to your project.

The error occurs on line 596 of the file OpenApiXmlCommentSupport.generated.cs.

Is there any way to disable XML comment generation? It's not a feature I am currently using.

If not, is there another way to prevent this build error?

1 Answer 1

2

To prevent the build error, you can add the following to a property group in your .csproj:

<InterceptorsNamespaces>$(InterceptorsNamespaces);Microsoft.AspNetCore.OpenApi.Generated</InterceptorsNamespaces>   

Source: I got the same error message as you and followed the instructions, which resolved the problem

Sign up to request clarification or add additional context in comments.

2 Comments

While this did work, it's not ideal for me, as the Microsoft.Aspnet.OpenApi package is referenced by a package I share with all of my Microservices. This change requires me to update every app that references by shared library. I was hoping for a while to disable it in the Shared package.
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.