Let's walk through creating a standard Build VM
You are here
AX 2012 Model Store Promotion Methods, part 1
AX 2012 Model Store Promotion Methods, part 1
You have just written some awesome code, and of course unit tested it, and can't wait to get it into your test environment. You know you don't want to use an XPO to move your changes because this is generally a bad idea almost always. So, what can you do? Here are a few different methods to move model stores around, once you have one built. Building a model store will be the topic of another post some day. We will assume you are familiar with the power shell commands for AX. You simply need to get into power shell for AX. You can review this generic conceptual method for moving a model store around. Please note you will need to add some time on your own before/after the SC commands as they are asynchronous and will end once a command has been issued to a service but not wait to make sure the service completed the request.
 
Method 1
This method assumes you have no time constraints so is probably best suited for a development or test environment. Please review all names and parameters. This will stop the AOS, import that modelstore, start the AOS again then do a DDL sync.
sc \\aos-dns-name stop "AOS60$01" Import-AXModelStore -File "\\path\to\my\current.axmodelstore" -noPrompt -database AX2012_modelDatabase -server sql-server-name sc \\aos-dns-name start "AOS60$01" "c:\Program Files (x86)\Microsoft Dynamics AX\60\Client\Bin\ax32.exe" -startupCmd=synchronize
Method 2
Special thanks to Derek Baker for this. This is more for a production environment as you can save a little time apply the modelstore before having to stop the AOS(s) which can be upwards of 20 or 30 minutes, depending. May or may not be worth the extra trouble but as a general rule anything that saves on the duration of a downtime event I am in favor of. This will create a temporary schema to work in, import the modelstore into it while the AOS(s) are up, then stop the AOS, apply the tmp modelstore, sets the noInstallMode flag, drops the tmp schema then starts the AOS and does a DDL sync.
Initialize-AXModelStore -SchemaName 'tmp' -NoPrompt ΓÇôVerbose -Server sql-server-name -Database AX2012_modelDatabase Import-AXModelStore -File "\\path\to\my\current.modelstore" -SchemaName 'tmp' -NoPrompt -Details -Server sql-server-name -Database AX2012_modelDatabase -Verbose sc \\aos-dns-name stop "AOS60$01" Import-AXModelStore -Apply 'tmp' -NoPrompt -Details -Server sql-server-name -Database AX2012_modelDatabase Set-AXModelStore -NoInstallMode -Server sql-server-name -Database AX2012_modelDatabase Initialize-AXModelStore -Drop 'tmp' -NoPrompt -Verbose -Server sql-server-name -Database AX2012_modelDatabase sc \\aos-dns-name start "AOS60$01" "c:\Program Files (x86)\Microsoft Dynamics AX\60\Client\Bin\ax32.exe" -startupCmd=synchronize