Skip to main content

Posts

Showing posts from February, 2023

Compile Model in D365 using PowerShell Script

 Hello Dev! We have a scenario when we need to compile ISV solution that has been locked so in that case you build or compile that specific model using PowerShell scripts. Alternate approach is you can reference that model with you existing model and then build that model with "Build model with reference".  Script:   Note : FlexProperty is my model param ( [switch] $Incremental, [switch] $Ref, [string] $Metadata = "C:\AOSService\PackagesLocalDirectory", [string] $CompilerMetadata = "C:\AOSService\PackagesLocalDirectory", [string] $XRefSqlServer = "localhost", [string] $XRefDbName = "AxDB", [string] $ModelModule = "FlexProperty", [string] $OutPut = "C:\AOSService\PackagesLocalDirectory\FlexProperty\bin", [string] $XmlLog = "C:\AOSService\PackagesLocalDirectory\FlexProperty\BuildProjectResult.xml", [string] $Log = "C:\AOSService\PackagesLocalDirectory\FlexProperty\BuildProjectResult.log", [string] $

Model import and export in D365 Finance and Operations using Powershell

Hello Devs! Whenever we have to move our code of specific model from one environment to another we need to export model and import it into another using model file via PowerShell. Below are the list of steps you need to perform for model export and import.                                                                Export Model File: 1) Open PowerShell in admin mode. 2) Change directory and navigate to bin folder using below command.   cd C:\AOSService\PackagesLocalDirectory\bin 3) Export the file using below command .\ModelUtil.exe -export -metadatastorepath=[path of the metadata store] -modelname=[name of the model to export] -outputpath=[path of the folder where the model file should be saved] In my case it look like this, Import Model File Prerequisite: The model should be deleted before importing the file, if it already exists in the folder.   1) Open PowerShell in admin mode. 2) Change directory and navigate to bin folder using below command.   cd C:\AOSService\PackagesLocalD