Skip to content

WebApi's linux builds fail when referencing HttpSys. #64930

@SitamMatt

Description

@SitamMatt

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

On Linux, when running dotnet build on project that targets .net10.0 and references .UseHttpSys() then build fails with error:

Program.cs(3,17): error CS1061: 'ConfigureWebHostBuilder' does not contain a definition for 'UseHttpSys' and no accessible extension method 'UseHttpSys' accepting a first argument of type 'ConfigureWebHostBuilder' could be found (are you missing a using directive or an assembly reference?)

However, when project targets .net9.0 or lower, then build succeeds on both Linux and Windows.

Expected Behavior

The described behaviour was not mentioned as breaking change, and building httpsys application should succeed on all platforms.

Steps To Reproduce

Program.cs:

var builder = WebApplication.CreateBuilder(args);

builder.WebHost.UseHttpSys();

var app = builder.Build();

app.Run();

Example.csproj:

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFrameworks>net10.0;net9.0;net8.0</TargetFrameworks>
    <Nullable>enable</Nullable>
    <ImplicitUsings>enable</ImplicitUsings>
  </PropertyGroup>

</Project>

Run (both windows and linux platform)
dotnet build
dotnet build --framework net10.0
dotnet build --framework net9.0
dotnet build --framework net8.0

Exceptions (if any)

No response

.NET Version

10.0.100

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions