19 November 2021

D365FO: custom resources are not deployed on developer's VM

I had another case recently when custom resources (JavaScript, HTML pages etc.) were not deployed to the Webroot folder on developer's VM. As a result, when such resources are required, different kind of errors are thrown, such as "file not found" or "runtime error".

This often happens when model binaries added on another machine to version control and got synchronized to the local VM. Resource deployment happens when deployment package is deployed manually or from LCS, but not when code/binaries are synchronized from Visual Studio.

It is possible to trigger resource deployment manually, here is how to do it. You will need any recent deployment package. If you do not have one, you could always create new from Visual Studio (via Dynamics 365 menu -> Deploy -> Create deployment package) or use one of the sample packages from "K:\AosService\PackagesLocalDirectory\bin\CustomDeployablePackage" folder.

  1. Extract all files from deployment package
  2. Open PowerShell console or ISE in Admin mode
  3. Run \AosService\Scripts\InstallMetadataPackages.ps1 script to redeploy resources

PS: there is another file with the same "InstallMetadataPackages.ps1" name located under K:\AosService\PackagesLocalDirectory\bin. In my case the file content is different and I get runtime errors while trying to run it.