C
C#5mo ago
Alizer

Scaffold Not Working because `dotnet-aspnet-codegenerator.exe` uses old C# version

I need help with scaffolding identity my C# project, I get this error whenever I scaffold D:\ProjectFolder\ClientAction(81,37): error CS1002: ; expected and I look into the line that causes this and I found it it's caued by the new required keyword
public class ClientAction
{
public required string Description { get; set; } // the required keyword causes this!
}
public class ClientAction
{
public required string Description { get; set; } // the required keyword causes this!
}
The project builds successfully in dotnet rider, no problems at all, however when it runs dotnet-aspnet-codegenerator.exe to scaffold I get a lot of errors, I'm thinking it's caued by dotnet-aspnet-codegenerator.exe using an old c# version, currently I use .net 7.0 Now my problem is that I have around 100+ properties using required and I needed to scaffold the Identity to edit the register and login pages, how do I get around this?
1 Reply
Angius
Angius5mo ago
If anything, it's caused by the codegenerator being newer than the version of .NET you're using That said, required is a keyword added in C# 11 Since you're using .NET 7, the project should also be on C# 11, so required should be fine Unless you did something wacky like setting the framework version to .NET 7, but the language version to C# 9 or some such