Hi @mc,
Can I use WebApplication.CreateBuilder in it?
You should use Microsoft.NET.Sdk.Web instead of Microsoft.NET.Sdk, since the Microsoft.NET.Sdk doesn't contains the web related package.
More details, you could refer to this article.
If you want to run web application in console application, you should firstly modify the csproj as below to use Microsoft.NET.Sdk.Web.
<Project Sdk="Microsoft.NET.Sdk.Web">
Then you could use WebApplication.
var builder = WebApplication.CreateBuilder(args);
var app = builder.Build();
app.MapGet("/", () => "Hello World!");
app.Run();
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.