Starts in:
2 DAYS
6 HRS
13 MIN
32 SEC
Starts in:
2 D
6 H
13 M
32 S
Open Closed

suite generated code is messy #4816


User avatar
0
cicna created

Check the docs before asking a question: https://docs.abp.io/en/commercial/latest/ Check the samples, to see the basic tasks: https://docs.abp.io/en/commercial/latest/samples/index The exact solution to your question may have been answered before, please use the search on the homepage.

If you're creating a bug/problem report, please include followings:

  • ABP Framework version: v7.0.3
  • UI type: MVC
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): no
  • Exception message and stack trace:
  • Steps to reproduce the issue:"

这个*Module.cs文件,我写了自已的代码,有中文注释。 This *Module.cs file, I wrote my own code, with Chinese comments.

当我用suite生成代码时,中文注释变成了乱码,如何解决的呢? When I use suite to generate code, Chinese comments become garbled. How do I solve this problem?


5 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Could you provide the steps to reproduce? thanks.

  • User Avatar
    0
    cicna created

    1、用abp suite创建一个mvc项目,例如:名为“Ywz.Bms” 1. Create an mvc project with abp suite, for example, "Ywz.Bms"

    2、在“Ywz.Bms.Web”下的BmsWebModule.cs文件,写上自已的代码,有中文注释。 2. In the BmsWebModule.cs file under "Ywz.Bms.Web", write your own code, with Chinese comments.

    3、用suite添加一个表,会生成一部分代码在BmsWebModule.cs文件,然后,这个文件的中文注释就变成了乱码。 3. Adding a table with suite will generate part of the code in BmsWebModule.cs file, and then the Chinese comments in this file will become garbled.

  • User Avatar
    0
    cicna created

    准确来说,凡是用到suite生成代码被覆盖的文件,主要有中文注释的,都会变成乱码。 To be precise, files that use suite generated code that is overwritten, mostly with comments in Chinese, become garbled.

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    You can use the editorconfig to set the encoding to utf8

    https://learn.microsoft.com/en-us/visualstudio/ide/create-portable-custom-editor-options?view=vs-2022

  • User Avatar
    0
    cicna created

    Add an .editorconfig file to the project root with the following contents:

    root = true  # 所在目录是项目根目录,此目录及子目录下保存的文件都会生效    
     
    [*]  # 对于所有文件
    indent_style = tab  # 缩进风格
    tab_width = 4  # 缩进宽度
    charset = utf-8  # 文件编码格式,Visual Studio使用utf-8-bom,以防警告
    end_of_line = crlf  # 行尾格式,Windows一般为CRLF,Linux一般为LF,根据需要更改
    insert_final_newline = true   #文件结尾添加换行符,以防警告
    

    All files for this project are automatically converted to uft8 encoding

    The official answer is so sweet thank you

Made with ❤️ on ABP v9.1.0-preview. Updated on November 20, 2024, 13:06