Monday, June 21, 2021

TF command line to fix the error: Mapping on the working folder is already in use

 Just to document my command line to get rid of this blocking error.


My environment is under Azure DevOps version control and some other user already created a workspace on this computer.

Close Visual Studio (2017 in my case) and open the command line. It can be open via Developer Command Prompt for VS 2017; so you would not need to provide the entire path to tf.exe.


Next, run a tf command to delete the workspace created by the previous user (Name and Surname)

tf workspace /delete DEV365-FO-VM-3;"Name Surname" /collection:https://YOURCOMPANYPROJECT.visualstudio.com






Then stop all locally running D365FO services, like Web Publishing, Batch processing, etc, in order to avoid errors with locked files in your K:\AosService\PackagesLocalDirectory subfolders.

Now you can open Visual Studio, connect to Azure DevOps server, create a new workspace, map your folders for projects and metadata, and get latest.

My first D365FO Build pipeline with Microsoft-hosted agent

This contains some particular details and explanatory images which can be useful while following the basic Microsoft article https://docs.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/dev-tools/hosted-build-automation

Thanks Joris for the NuGet packages and other colleagues for their help.

So, my goal is to create a Build pipeline for Version 18, and my deployable package must have a few ISV models, one of which is provided as libraries and source code.

Personal Access Token

First create or update your Personal Access Token and copy-paste it in a secure place (I mean Notepad++, of course). This will be used as a password for uploading Nuget packages to your Artifacts feed later.




Create a feed



Create nuget.config file and place it together with Nuget files as described in the next part.

NuGet packages

Get NuGet packages from LCS shared asset library.


Place these files in a special NuGet folder and create or update packages.config file.





Add them to the source controlled folder. DEV must be mapped too.





Publish packages by using the command line

Now open Windows command prompt to publish these Nuget files to your feed.



Use your Personal Access Token as a password.





Once uploading is done, you can check that the feed contains all packages.





Creating the pipeline

Before importing or creating a pipeline, install Azure DevOps pipeline tools Dynamics 365 Finance and Operations from Marketplace in your Extensions.





I export a pipeline from one organization and then import it to mine.



Then check and update the project name and relevant folder references, change variables and triggers, if needed.

Visual Studio build step

As one of my ISV provided in mix code/binaries mode, I need to reference its non X++-libraries at this step.





/p:ReferencePath A semicolon-separated list of paths that contain any non-X++ binaries that are referenced and required for compilation. You should include the location of the extracted Compiler Tools NuGet package, because it might contain required references.


So, once triggered it builds the solution, creates a deployable deployable package and publishes it.






Published artifacts can be found here.