OrchardCMS / OrchardCore

Orchard Core is an open-source modular and multi-tenant application framework built with ASP.NET Core, and a content management system (CMS) built on top of that framework.
https://orchardcore.net
BSD 3-Clause "New" or "Revised" License
7.43k stars 2.4k forks source link

Guidance for .net 7 Program.cs #13355

Closed JoshTango closed 5 months ago

JoshTango commented 1 year ago

What is the guidance for a new asp.net project in .net 7? We don't have a startup file anymore and instead just have a program.cs. The documentation has a gif showing the steps for I assume pre .net 7?

JoshTango commented 1 year ago

Here is the code generated by visual studio for program.cs which I assume we can remove some of these lines:

`var builder = WebApplication.CreateBuilder(args);

// Add services to the container. builder.Services.AddRazorPages();

var app = builder.Build();

// Configure the HTTP request pipeline. if (!app.Environment.IsDevelopment()) { app.UseExceptionHandler("/Error"); // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. app.UseHsts(); }

app.UseHttpsRedirection(); app.UseStaticFiles();

app.UseRouting();

app.UseAuthorization();

app.MapRazorPages();

app.Run();`

jtkech commented 1 year ago

https://github.com/OrchardCMS/OrchardCore/blob/a04a6bebc606e81c4d8cd21f8186b2b20ccfb0c0/src/OrchardCore.Cms.Web/Program.cs#L1-L22

JoshTango commented 1 year ago

Ok thanks. Then the documentation needs upgraded I guess.

jtkech commented 1 year ago

Yes ;)

hishamco commented 1 year ago

Ok thanks. Then the documentation needs upgraded I guess.

Where? what I see in https://docs.orchardcore.net/en/latest/docs/getting-started/ is correct

JoshTango commented 1 year ago

this one:

https://docs.orchardcore.net/en/latest/docs/getting-started/templates/

JoshTango commented 1 year ago

there is a step in https://docs.orchardcore.net/en/latest/docs/getting-started/templates/ called so:

Finally, we will need to register Orchard CMS service in our Startup.cs file like this:

hishamco commented 1 year ago

@JoshTango could you please open a PR?

hishamco commented 1 year ago

@agriffard did docs.orchardcore.net contains the latest update from the nightly builds?

agriffard commented 1 year ago

@agriffard did docs.orchardcore.net contains the latest update from the nightly builds?

https://docs.orchardcore.net/en/latest/... is built based on the main branch.

Piedone commented 5 months ago

This was done in https://github.com/OrchardCMS/OrchardCore/pull/13380.