Hi @My Nguyen ,
GenZBookWeb - When I add project reference GenZBook.DataAccess and add new Scaffolded item MVC Area, it throws an error. I think there's something wrong with CodeGeneration.Design 6.0.9. I tried to clean the solution/projects, rebuild and re-adding the Scaffold page but the error still occurs. Hope the helping, tks!!!
Yes, you are right, the issue relates the CodeGeneration.Design package. I could reproduce the problem using 6.0.9 version, 6.0.8 version and 6.0.0 version. But it works well on asp.net 5 and CodeGeneration.Design 5.0.2.
This is a known issue, you can also feedback this issue to the Scaffolding forum, hope they can fix it in the next version.
As a workaround, you can try to the following steps:
- Remove the DataAccess reference from the GenZBookWeb project
- Create models (use the same name) in the GenZBookWeb projects
- In GenZBookWeb projects, you can use Scaffold to add the generate pages
- Remove the models from the GenZBookWeb project and re-add the DataAccess project reference. [Note] You need to change the model reference in the generated page.
Besides, you can also create a new project, which contains the Web and DataAccess model in the same project, then generate the page using Scaffolded, after that you can copy the generated page to the GenZBookWeb project.
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.
Best regards,
Dillion