Marco hit the nail on the head with this for me, I commented out the namespace, program class definition and main method from my program.cs file, confirmed that my project still ran, and I was able to scaffold the razor identity pages I was looking for instead of getting the zero length error.
//namespace ChatBotTemplate
//{
// public class Program
// {
// public static async Task Main(string[] args)
// {
var builder = WebApplication.CreateBuilder(args);
//More code
var app = builder.Build();
// }
// }
//}
Cheers Marco.