简体   繁体   English

使用Git版本Microsoft Dynamics NAV?

[英]Using Git to version Microsoft Dynamics NAV?

I'm a .NET developer, but in our organization we also have a couple of Microsoft Dynamics NAV developers. 我是.NET开发人员,但在我们的组织中,我们还有几个Microsoft Dynamics NAV开发人员。 Currently they're not using any source control. 目前他们没有使用任何源代码控制。 I know very little about NAV, but as I understand it, you can script out objects from NAV and import back in from the scripts. 我对NAV知之甚少,但据我了解,你可以编写NAV中的对象并从脚本中导入。

That being the case, is anyone using Git with NAV? 既然如此,是否有人使用GIT与NAV? Have you run into any gotchas along the way? 你有没遇到任何陷阱? I'm wondering if this is a good solution to suggest to them, and whether it's any more complicated to manage than using Git with .NET (which I've found reasonably easy). 我想知道这是否是一个很好的解决方案,建议他们,以及管理是否比使用Git with .NET(我发现相当容易)更复杂。

Yes we are using Git together with Dynamics NAV with great success! 是的,我们正在使用Git和Dynamics NAV取得巨大成功!

The bad thing is that all objects must be exported to txt before Git gives meaning. 不好的是,在Git赋予意义之前,必须将所有对象导出到txt。 Let's hope that Microsoft will create an easier approach to exporting objects to txt. 让我们希望微软能够创建一种更简单的方法来将对象导出到txt。 We are using this model. 我们正在使用这个模型。 Create a Git repository with a general master, and a branch for each object we change. 使用通用主服务器创建Git存储库,并为我们更改的每个对象创建一个分支。 All source files must have the same name as the branch top file to make Git track differences. 所有源文件必须与分支顶级文件具有相同的名称,才能使Git跟踪差异。 Using Git in this way, we never merge anything into master. 以这种方式使用Git,我们永远不会将任何东西合并到master中。 After starting using Git it's much easier to work on shared objects and track what other NSC's have done with the code. 在开始使用Git之后,更容易处理共享对象并跟踪其他NSC对代码所做的事情。 And IT-Revision is happy because all code is well documented and the way to any fallback is much easier. IT-Revision很高兴,因为所有代码都有详细记录,并且任何后备的方式都更容易。 I'll give my full endorsement to use Git with Dynamics NAV. 我将全力支持使用Git和Dynamics NAV。

Navision Consultant, in Oil & Energy Industry 石油与能源行业的Navision顾问

I'm using Dynamics NAV and Git, however not at the same time. 我正在使用Dynamics NAV和Git,但不是在同一时间。 Let me explain why. 让我解释一下原因。

The Git itself is cool (with GitHub it gets even better), but the Windows port is poor, unless you don't like to stick to unix-like command line, since it's the recommended way to setup msysGit . Git本身很酷( GitHub变得更好),但是Windows端口很差,除非你不喜欢坚持使用类似unix的命令行,因为它是建议使用msysGit的方法 The GUI tools on Windows are no good, unfortunately. 不幸的是,Windows上的GUI工具并不好。

For me it was hard to make my boss understand, why using distributed version control is better than the usual TFS. 对我来说很难让老板理解,为什么使用分布式版本控制比通常的TFS更好。 For business-oriented guys one big central repository feels more secure (because it's my own server I pay for, I control access to) and more robust (I hired a system administrator who will run maintenance procedures). 对于面向业务的人来说,一个大的中央存储库感觉更安全(因为它是我自己支付的服务器,我控制访问权限)和更强大(我雇用了一个将运行维护程序的系统管理员)。

I decided not to fight against this will. 我决定不反对这种意志。 We're using distributed version control as a staging area. 我们使用分布式版本控制作为临时区域。 All unstable changes are stored in this area and we do testing within our team. 所有不稳定的更改都存储在此区域中,我们会在团队中进行测试。 After finishing stabilization, objects are merged into the central repository. 完成稳定后,对象将合并到中央存储库中。 Everybody looks happy. 每个人都很开心。

Regarding Git: Recently I switched to another distributed version control — fossil due to following reasons: 关于Git:最近我切换到另一个分布式版本控件 - 化石由于以下原因:

  • It can do everything that Git can; 它可以做Git所能做的一切;
  • It looks, feels and acts native on Windows; 它在Windows上的外观,感觉和行为;
  • It has a web-interface build-in and I can easily make it run as a native Windows service; 它有一个Web界面内置,我可以轻松地将其作为本机Windows服务运行;
  • It has integrated issue-tracking, so I don't need third-party tools any more; 它集成了问题跟踪功能,因此我不再需要第三方工具;
  • The Repository is a single file, so I can take it with me on a pen drive everywhere I want; 存储库是一个单独的文件,因此我可以随身携带在我想要的任何地方的笔式驱动器上;

Regarding our NAV solution. 关于我们的NAV解决方案。 It's more than 1000 objects, size over 20 MB. 它超过1000个对象,大小超过20 MB。

EDIT: Some updates after more than half year of coding. 编辑:经过半年多的编码后的一些更新。

We switched back to git. 我们换回了git。 Since its automatic merge is AWESOME . 由于它的自动合并是真棒 Just to win the bet I've moved a solution (modified standard objects and new ones) from NAV7CTP3 to NAV7CTP5 in 4 hours. 为了赢得赌注,我已经在4小时内将解决方案(修改过的标准对象和新标准对象)从NAV7CTP3移动到NAV7CTP5。 While a team of four developers achieved the same result needing almost three weeks of everyday work. 虽然由四名开发人员组成的团队取得了相同的成果,但需要将近三周的日常工作。

Git really makes a difference. Git真的有所作为。 I believe the same results are possible with other distributed version control systems. 我相信其他分布式版本控制系统可以获得相同的结果。

The reason is: Git and other distributed systems save a lot more information during a commit than ie TFS and SVN. 原因是:Git和其他分布式系统在提交期间比TFS和SVN节省了更多信息。 It is not so important during regular development, but when it comes to merging, all this 'redundant' information from Git makes the difference. 在常规开发过程中并不是那么重要,但是当涉及到合并时,来自Git的所有这些“冗余”信息都会产生影响。

During the merge Git finds the common revision which started a branch and then applies changes from both branches step by step - in the same way as the developer changed the code - to all files in solution. 在合并期间,Git找到启动分支的通用修订版,然后逐步应用来自两个分支的更改 - 与开发人员更改代码的方式 - 应用于解决方案中的所有文件。

If the same line was changed in both branches it shows the conflict. 如果在两个分支中更改了相同的行,则表明存在冲突。 If not it just saves the files into the working folder ready for commit. 如果不是,它只是将文件保存到准备提交的工作文件夹中。

Here some statistics: 这里有一些统计:

  • The Total number of files processed in both CTP3 and CTP3 codebases is around four thousand each; 在CTP3和CTP3代码库中处理的文件总数大约是四千个;
  • The Total number of the solution's objects merged is 1170; 合并的解决方案对象的总数是1170;
  • The Total number of conflicting files is 140; 冲突文件总数为140;
  • The rate of successful automatic merge is about 88% (1170 – 140) / 1170 * 100 = 88%; 成功自动合并的比率约为88%(1170-140)/ 1170 * 100 = 88%;
  • Most conflicts are changes in the object's versions — trivial; 大多数冲突都是对象版本的变化 - 微不足道;
  • None-trivial conflicts in about 20 files; 大约20个文件中的重要冲突;
  • Trivial find and replace was done on all merged objects (to fix RunFormOnRec -> RunPageOnRec, etc.); 对所有合并对象进行了简单的查找和替换(修复RunFormOnRec - > RunPageOnRec等);
  • The result is a fully importable set of the most recent solution objects based on CTP5; 结果是一组完全可导入的基于CTP5的最新解决方案对象;
  • The Number of compile errors after import is about 50; 导入后的编译错误数约为50;
  • Most of these errors relate to changes in standard objects done from CTP3 to CTP5; 大多数这些错误与从CTP3到CTP5完成的标准对象的变化有关;
  • The rate of faulting objects is around 4% (50 / 1170 * 100% = 4%); 断层物的发生率约为4%(50/1170 * 100%= 4%);

We are using git with Dynamics NAV with great success. 我们正在使用带有Dynamics NAV的git并取得了巨大的成功。

But I have to say, it was not easy. 但我不得不说,这并不容易。 Dynamics NAV (we use version 2013) is not optimized for git or file-based development. Dynamics NAV(我们使用的是2013版)未针对git或基于文件的开发进行优化。 The developing is usually done directly in the development environment (classic client) that saves the source code directly into the database. 开发通常直接在开发环境(经典客户端)中完成,该环境将源代码直接保存到数据库中。

So what we did to support git is: We build a lot of useful PowerShell commands that are helping developers to synchronize a NAV DB with a local git folder. 所以我们为git提供的支持是:我们构建了许多有用的PowerShell命令,帮助开发人员将NAV数据库与本地git文件夹同步。 Fe we have a command that exports all objects with a modified flag into the local git folder - or a command that imports all objects between to git commits. 我们有一个命令可以将带有修改标志的所有对象导出到本地git文件夹中 - 或者是一个导入git提交之间所有对象的命令。 We even use that to automatically update our test database with a git push on the development machine. 我们甚至使用它来自动更新我们的测试数据库,在开发机器上使用git push

But that's to saying: It wasn't easy to develop all these procedures and build scripts. 但这就是说:开发所有这些程序并构建脚本并不容易。

So I would recommend you to think twice about the decision of using git with Dynamics NAV. 所以我建议你三思而后行使用git和Dynamics NAV的决定。 The software is not build to work with git, so you will have to do a lot of work - and the question is if your boss is willing to give you the time to build the necessary tools to work smoothly. 该软件不适用于git,所以你必须做很多工作 - 问题是你的老板是否愿意给你时间来建立必要的工具来顺利工作。

Take a look also at Object Manager Advanced . 另请参阅对象管理器高级版 That is a tool that we used before. 这是我们以前使用过的工具。 I saw once a preview from idyn (Company) where they replaced the classic development environment client with visual studio! 我曾经看过idyn (公司)的预览,他们用visual studio取代了经典的开发环境客户端! We switched from Object Manager Advanced to git as main development tool because it was not fitting for our business cases. 我们从Object Manager Advanced切换到git作为主要开发工具,因为它不适合我们的业务案例。 But we are still using it fe for the Where Used function witch is great! 但是我们仍在使用fe for Where Used功能女巫很棒! (Movie is from an old NAV version, sorry) (电影来自旧的资产净值版本,对不起)

I've been using Git and and Navision 2009 (and older) for a long time and it's so worth it. 我一直在使用Git和Navision 2009(及更早版本),这非常值得。

As there's no native Git support, I export Navision code in the ID Number area that we're allowed to program in into a big text file. 由于没有本机Git支持,我将ID号区域中的Navision代码导出到一个大文本文件中。 (select .txt format for export). (选择.txt格式进行导出)。 Or set a delimitation on all the modules I changed by date and export this. 或者在我按日期更改的所有模块上设置分隔并导出。

I wrote a Python script that takes this text file and splits it into a single file per Object (Form, Table, Codeunit), just like if you would save everything manually. 我写了一个Python脚本,它接受这个文本文件,并将它分成每个Object(Form,Table,Codeunit)的单个文件,就像你手动保存所有内容一样。 It saves them to a network folder I have under Git control. 它将它们保存到我在Git控制下的网络文件夹中。

While it took a few days to get the process working fully, now the whole process only takes a few minutes per update. 虽然花了几天时间让这个过程完全运行,但现在整个过程每次更新只需要几分钟。 The only disadvantage of this is that Navision itself doesn't export who did changes, so the Git will not reflect that. 唯一的缺点是Navision本身不会导出谁做了更改,因此Git不会反映出这一点。

Still it's great that I can control what has been changing in our Navision source code fully. 仍然很好,我可以完全控制我们的Navision源代码中的变化。 Also, if you are working in a poorly documented Navision environment, having the complete code in a form, that you can search, is a huge timer saver. 此外,如果您在一个记录不完整的Navision环境中工作,那么您可以搜索一个表单中的完整代码,这是一个巨大的计时器保护程序。 Apart from grepping the codebase to locate error message texts, another advantage is that you can then write a script, that will tell you what code is allowed to modify a specific table. 除了搜索代码库以查找错误消息文本之外,另一个优点是您可以编写脚本,该脚本将告诉您允许修改特定表的代码。 So that if you refactor a table, you will instantly know what code needs checking... 因此,如果您重构一个表,您将立即知道需要检查哪些代码...

For Git itself, I use a few basic command line commands. 对于Git本身,我使用了一些基本的命令行命令。 To examine changes, I use the visual P4MERGE tool that is natively supported by current Git version. 为了检查更改,我使用了当前Git版本支持的visual P4MERGE工具。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM