Monday, August 20, 2018

d365FO - how to copy elements from a model to another

One of requirement you probably come across is to copy/move objects across models. Here, a simple way I did.

Task - Copy and rename ABC- to XYZ- classes across the following environments. Server A (Model X) --> Server B (Model Y)

Solution
1) Make sure model, VS solution and VS project are already created for the new model Y.
2) Close and exit from Visual studio IDE.
3) Copy all ABC- classes to folder C:\AOSService\PackagesLocalDirectory\Y\Y\AxClass.
4) Rename all prefix of file name by Windows PowerShell.
            Dir | Rename-Item -NewName {$_.name -replace "ABC","XYZ"}
5) Use your text editor to rename "ABC" to "XYZ".
6) Repeat step 3-5, but on C:\AOSService\PackagesLocalDirectory\Y\XppMetadata\Y\AxClass
7) Find the source project file (RNRPROJ file), and then copy the following structure to the destination project file. And yes, again rename the prefix to XYZ.
    <Content Include="AxClass\ABCprocessClass">
      <SubType>Content</SubType>
      <Name>ABCprocessClass</Name>
      <Link>Classes\ABCprocessClass</Link>
    </Content>
8) Open Visual studio again. Verify the change by build the model.

Until the next post!


Ref:
https://community.dynamics.com/ax/f/33/t/193502
http://daxonline.org/1607-how-to-import-project-from-one-model-to-another-d365fo.html
https://www.windowscentral.com/how-rename-multiple-files-bulk-windows-10

No comments:

Post a Comment