【问题标题】:How do I suppress warnings when compiling a Business Central Extension编译 Business Central Extension 时如何抑制警告
【发布时间】:2021-11-03 18:59:52
【问题描述】:

我想禁用警告 AL1025,因为 AL 编译器的性质,我收到很多与我的 node_modules 文件夹相关的警告。显然,它should be possible 像这样抑制 app.json 中的警告

  "suppressWarnings": ["AL1025"]

但我仍然收到这些警告:

Microsoft (R) AL Compiler version 7.4.7.43721
Copyright (C) Microsoft Corporation. All rights reserved

Compilation started for project 'ABC Sample Ext' containing '11' files at '19:58:7.337'.

/Users/username/Dev/abc-workspace/abc-sample/node_modules/he/LICENSE-MIT.txt(1,1): warning AL1025: The file at location '/Users/username/Dev/abc-workspace/abc-sample/node_modules/he/LICENSE-MIT.txt' does not match any definition.

我做错了什么?

【问题讨论】:

    标签: visual-studio-code dynamics-business-central dynamics-al


    【解决方案1】:

    您需要定义一个规则集,告诉编译器忽略哪些警告/错误。

    这有两个部分:

    1. 定义规则集
    2. 激活规则集

    规则集以 JSON 格式定义,带有 namedescriptionrules 的集合。规则必须有 iddescriptionjustification

    一个例子可以是:

    {
        "name": "Custom ruleset",
        "description": "Set some rules as hidden",
        "rules": [
            {
                "id": "AL1025",
                "action": "Info",
                "justification": "Allow non-AL files in workspace"           
            }
        ]
    }
    

    然后你需要激活你定义的规则。这是通过在settings.json(在.vscode 文件夹中)定义al.ruleSetPath 来完成的:

    {
        "al.ruleSetPath": "./custom.ruleset.json"
    }
    

    【讨论】:

    • +1 用于解决方法,但我更愿意让 app.jsonsuppressWarnings 属性正常工作。
    • 我想您使用的 Business Central 版本可能存在依赖性。那是哪个版本?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-10-02
    • 2020-12-26
    • 1970-01-01
    • 2011-03-26
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多