Edit

Share via


HTTP/3 support in System.Net.Http disabled by default with PublishTrimmed

Setting PublishTrimmed or PublishAot to true in the project disables HTTP/3 support in System.Net.Http by default.

Version introduced

.NET 10 Preview 6

Previous behavior

Previously, HTTP/3 support was allowed, but might not have actually worked by default in environments where the msquic native library wasn't available. This resulted in HTTP/3 not actually working while the app carried all the code related to it.

New behavior

Starting in .NET 10, HTTP/3 is disabled and the code for it isn't included when PublishTrimmed or PublishAot is set to true.

Type of breaking change

This change can affect source compatibility.

Reason for change

Since making HTTP/3 work requires extra gestures and often doesn't work by default, the runtime no longer carries the code for it in trimmed or AOT-compiled applications.

To enable HTTP/3 support in applications that use PublishTrimmed or PublishAot, set the <Http3Support> property to true in your project file:

<PropertyGroup>
  ...
  <PublishTrimmed>true</PublishTrimmed>
  <Http3Support>true</Http3Support>
</PropertyGroup>

Affected APIs

None.

See also