blogged about how to rename files with my
VSCode Extension to comply with the new
filename conventions from Microsoft.
Somewhat related to that, we need to talk about …
been known for a while: pre-or suffixing is necessary to “live in the
cloud”. It prevents duplicate names
in various places: duplicate table names, duplicate field names .. things like
that. It is actually very well described
on Microsoft Docs here: https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/compliance/apptest-prefix-suffix.
you need to pre-or suffix, especially for apps on AppSource, but actually on
anything you do!
probably familiar with : the codecop
with code analysis rules that are specifically for AppSource. Well .. when you enable this, it can help
you. And in the next release: it will
force you to remember to set an affix (which means: a suffix or a prefix).
simply enable the AppSourceCop by:
of “affixes”, the AppSourceCop needs to know which you use. If you don’t do that – in the next release
(v16) – the analyzer will tell you that you HAVE to tell him:
documentation, it’s quite clear what you need to do:
see that IntelliSense will help you to complete this file… . As you can see, I also provided the supported
countries as also that will be mandatory (by a coderule) in release 16. But let’s focus on the affixes in this post
;-). What I told the AppSourceCop in
this case, is that I will use only one affix, being “WLD”.
you’re not done yet. All you’ve done
now, is told the AppSourceCop on which affixes it needs to check the objects
and controls. That way, it can
“remind” you that you need to pay attention to it, like here:
it’s your job now to take this into
account, and haven decent names for your objects, fields, .. .
No! But don’t worry – that’s where I come in
;-). You might be familiar with my
“CRS AL Language Extension” in VSCode that can handle renames of
files. Well, during the rename, it can
provide a prefix or suffix. So by
simply setting some extra settings for my extension (and yes – by providing the
suffix again), you’ll be able to get this going for you in an automated way:
this setting will automatically provide the WLD-suffix where it needs to when
you save a file.
AppSourceCop allows multiple affixes .. and my CRS AL Language Extension does
not. So whenever you intend to use
multiple affixes, I’m afraid you’ll have to disable the automatic rename by my
extension, because it will only apply one.
Simply remove the settings about the suffix, and provide it manually
(AppSourceCop will remind you where ;-)).
– if you enable the CodeCop in the next release, you’ll even have another rule
to worry about: file name conventions.
So, if you enable codecop:
something you could get in v16:
blogged about that very recently, so I’m not going to repeat that. BUT – this coderule is also going to assume
than when you used this “MandatoryAffixes” (which you have to in the
next release), that you DON’T use the affix in the filename (read the error
above carefully, and you’ll notice it doesn’t want my affix in it).
had foreseen this setting for it:
also is only useful for only one suffix or prefix at this moment.
– auto renaming can become a challenge … :-/ … and that sucks…
that I intend to solve for you in the near future. This is what I intend to do in short term:
at least how I have it in my head now … .
I also realise that simplicity is key – I shouldn’t make it too
complicated to use this. So .. yeah ..
this did give me quite some headaches already ;-). So, if you have any idea, feedback, tip, …
please share ;-). I’m open for all