EasyAbp / AbpHelper.CLI

Providing code generation and more features to help you develop applications and modules with the ABP framework.
MIT License
285 stars 95 forks source link

Missing necessary "using" after generating razor page #78

Closed motl2000 closed 4 years ago

motl2000 commented 4 years ago

ABP framework V2.9 Following the Bookstore demo on the ABP docs, there are errors after generating the razor page. For example, in the CreateModal.cshtml.

@page @using AbpHelp4.Localization @inject IHtmlLocalizer L @model AbpHelp4.Web.Pages.AbpHelp4.Book.CreateModalModel @{ Layout = null; }

  1. The "IHtmlLocalizer" will not be recognized because missing reference.
  2. AbpModalButtons also need reference.

2 reference need to be added. @using Microsoft.AspNetCore.Mvc.Localization @using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal;

gdlcf88 commented 4 years ago

This is about AbpHelper CLI. @wakuflair

The "using" has been removed in the commit: https://github.com/EasyAbp/AbpHelper.CLI/commit/71f02288545c185d2a21af62ce36b2b16fc41a23

motl2000 commented 4 years ago

OK, but it causes debug error after generate code. Do I miss something?

wakuflair commented 4 years ago

Hi @motl2000 Thank you for this issue, CLI has this bug indeed. It's been fixed by https://github.com/EasyAbp/AbpHelper.CLI/commit/bfc4f4ff4a0d51b347cb1c8956c8ca2bb027f32d

@gdlcf88 The "using" statements are removed by Rider when commit. Because I checked on the "Optimize improts" option, which should be very careful when you have generation work.