Вернуться   AXForum > Microsoft Dynamics NAV > NAV: Blogs
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск Все разделы прочитаны

Опции темы Поиск в этой теме Опции просмотра
Старый 03.04.2020, 13:11   #1  
Blog bot is offline
Blog bot
23,057 / 786 (73) +++++++
Регистрация: 28.10.2006
waldo: How to REALLY rename all AL-files of your Business Central app..

You remember thispost? I tried to warn you that whenv16 comes out, there will be a new code rule that will check your filenames –and you’ll have to (if you don’t disable it) comply with the file nameconvention of Microsoft. If you don’tautomate your file naming, then you’re in for some .. uhm .. challenges. I just made sure that the automation of thefilenames complied with Microsoft’s rules .. .

I need to correct mystore in that post though. I had beenworking on this “RenameWithGit” setting, which didn’t work withmultiroot workspaces and had some other stability problems. Only after my post – thanks to a reactionfrom James Pearson on twitter – I learnedthere is a much simpler way to do this.

First of all …

Forgetabout the “RenameWithGit” setting

Indeed – just forgetI ever built it. I’m actually thinkingof taking it away in the near future. Ialready removed it from all my workspaces, and I strongly recommend you to dothe same. It doesn’t work like it’ssupposed to work .. and I’m embarrassed enough about it ;-).

There is only oneword you need to remember ..


All you have to doafter you renamed all objects is to stage the changes. That’s it. And then you’ll see that actually everything is just fine.. . I found some kind of description about thisability here:

If you’d rename afile, you will get a delete and a new untracked file in Git, like you can seehere:

When you stage the filein vscode, you get the rename:

What it actuallydoes in a stage is it will compare the files, and when more than 50% is thesame, it will indicate it as a “rename” it in stead of deleting theold name, and creating a new file. That’s smart!

And yes, indeed ..I have been immensely wasting my time on the “RenameWithGit” setting:(.

Can Imake sure everyone always stages before commit?

Well .. It’sactually good practice to always “intentionally” stage. You must have seen this message already:

In VSCode, it’scalled “smartcommit”. Buthonestly, in my opinion, the smartest commit is an intentional commit. I don’t like this message, and I switch itoff by setting this up in my user settings:

“git.suggestSmartCommit”: false

I’m not forcing youto do so .. but this way, you can easily check in VSCode if the rename of thefile, was actually a rename of the file– and not deleted and new files. Like itwas intended.

So,what is now the safest workflow to rename my files?

Quite the same as Imentioned in my previous post about this – but a bit different.

1. Create a new branch

Yep, I still recommend to do the entireprocess in a separate branch. Ofcourse. It will give you a way out ifyou messed up ;-).

2. Change the setup

The setup is actually very similar as in my previous post, only now with the “RenameWithGit” = false. To match the file name convention of Microsoft .. this is what I would use:

"CRS.FileNamePattern": "", "CRS.FileNamePatternExtensions": "", "CRS.FileNamePatternPageCustomizations": "", "CRS.OnSaveAlFileAction": "Rename", "CRS.RenameWithGit": false, "CRS.ObjectNameSuffix": " WLD",Alternatively,you could add the “RemovePrefixFromFilename” or“RemoveSuffixFromFilename” – but make sure you setup the mandatoryAffixes-setting in the AppSourceCop.json as well, for theCodeCop to accept the removal of the prefix or suffix.

3. Commit

Thiscommit is there because you might want to revert after a failed rename-attempt.

4. Rename all

Thisis the same “Rename All” function I talked about in my previous post:

Itwill rename all files of the current active workspace (the active workspace isthe workspace of the currently activated document (file)) – not allworkspaces. So you probably have to dothis for all workspaces separately. Thanks to the “RenameWithGit” to false, I expect nomistakes. I was able to apply this to+6000 files today .. so it’s tested, I guess ;-).

5. Stage

Thisis THE step I was talking about earlier. Here you can check if the rename was successful – all renamed files should indicate an “R”, like:

Whenyou see that – you’re good to go and …

6. Commit

Justcommit, push and create a pullrequest to the necessary branch .. and you shouldbe done!

Wait.. So I can do this in a multiroot workspace as well?

Yes indeed – thisflow does work in a multiroot workspace. Do execute it for all workspaces separately though, like mentionedbefore. That’s how I implemented it.. .


It’s a piece of cake.  Really.  So just do it, comply with the naming convention, and don’t feel like you’re cheating on Microsoft ;-).

Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
waldo: Why and how to rename all AL-files of your app with the “CRS AL Language Extension” Blog bot NAV: Blogs 0 09.01.2020 09:14
waldo: Business Central as an app: getting to the al source code Blog bot NAV: Blogs 0 01.03.2019 23:14
alexef: How to add a field to Item Card in Business Central Blog bot NAV: Blogs 0 22.05.2018 20:11
german_nav_developer: Buildnummern-Übersicht Microsoft Dynamics NAV 2013 R2 Blog bot NAV: Blogs 0 15.05.2016 18:12
german_nav_developer: Buildnummern-Übersicht Microsoft Dynamics NAV 2013 Blog bot NAV: Blogs 0 15.05.2016 18:12
Опции темы Поиск в этой теме
Поиск в этой теме:

Расширенный поиск
Опции просмотра

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Часовой пояс GMT +3, время: 22:31.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.