Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Suggested answer

Treat best practice warnings as error

(0) ShareShare
ReportReport
Posted on by 20

Hi all

is it posible to treat best practice deviations as compiler error so the developer must fix his issues? We did it for our team in the past having a global ruleset for all developers when we writing .net code. I want to have a global ruleset for every developer in our team. I'm now reworking the whole solution/model because developers forget to assign labels or using deprecated functions... I think it's more Visual Studio related question... Did someone have some experience with that?

  • Martin Dráb Profile Picture
    Martin Dráb 230,836 Most Valuable Professional on at
    RE: Treat best practice warnings as error

    Moved to Dynamics 365 Finance Forum.

    If you use gated check-ins, that's the obvious place where to do it. And if you don't, consider if it isn't the right appoach, before you start building anything special in Visual Studio.

    Personally, I work on a huge project with a legacy codebase with many warnings and my gated builds merely dump information about BP to an Azure table, so I can easily see how things are changing, and I can intervene. But I could also fail the build if the number of violations doesn't meet certain criteria.

  • dklimke Profile Picture
    dklimke 20 on at
    RE: Treat best practice warnings as error

    Sorry, i'm talking about Dynamics 365 F&O, Visual Studio 2019 Prof.

  • Martin Dráb Profile Picture
    Martin Dráb 230,836 Most Valuable Professional on at
    RE: Treat best practice warnings as error

    Which kind of development are you talking about? Isn't it about X++? Please note that you're asking in the generic D365 forum, therefore we can't know if you mean BC, CE, F&O or some other related development.

  • Suggested answer
    Naveen Ganeshe Profile Picture
    Naveen Ganeshe 3,393 User Group Leader on at
    RE: Treat best practice warnings as error

    Hello Dirk,

    It's always a good thing to enforce best practices in the early dev stage.  I believe you can utilize the Code Analysis feature in Visual Studio which has Microsoft recommended rules as well as you can create your own.

    You can also use ReSharper as well for code analysis and

    learn.microsoft.com/.../how-to-configure-code-analysis-for-a-managed-code-project

    learn.microsoft.com/.../how-to-create-a-custom-rule-set

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,965 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,836 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans