web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Switch to different branches

(1) ShareShare
ReportReport
Posted on by 4,131

Hi,

I have a look at the FastTrack team training material.

One screenshot shows map to different branches from Visual Studio. 

Workspace.jpg

Can we check in code directly into different branches? For example, if we are working on hotfix to release branch, how to choose which branch when we check in the code?

Thanks,

I have the same question (0)
  • Verified answer
    Sukrut Parab Profile Picture
    71,710 Moderator on at

    If you have created different work spaces which map to different branches then while checking in on pending changes screen you have option to change workspace . for example , Dev , Main , release etc.. however you dont check in hotfixes directly to Main pr release branch . It has to go through dev branch and merging process. SO install it on dev first and then merge it to Main branch. 

  • Verified answer
    WillWU Profile Picture
    22,361 on at

    Hi Yuji ,

    Here is a article about Devops, and I think you can learn a lot about it.

    https://ariste.info/en/2019/02/dynamics-365-for-finance-operations-and-azure-devops-part-ii/

    Hope this helps.

  • Verified answer
    Sukrut Parab Profile Picture
    71,710 Moderator on at

    Instead of creating  mapping for all branches in a single workspace create separate workspaces and do mapping over there. That gives you a  great ability to switch workdspaces on pending changes window while checking in the code and you know where exactly you are checking in your object.  separate workspace kind of set up is helpful when you do  merge from for example dev > main. once you finish merge , just change the workspace to main and you will see all the objects of the change set you merged under pending changes.

  • SaverioT Profile Picture
    330 on at

    Every workspace has to be mapped to different local directory ? So we have also to change the web.config to  point to different LocalPackagesDirectory ?

    Because I try to create a second workspace that point to another branch, but I get the error that foder are already mapped.

  • Martin Dráb Profile Picture
    237,801 Most Valuable Professional on at

    What I do is leaving PackagesLocalDirectory without any custom code. I have a separate folder for a repository, where I have folders for different branches. Each of this has its own workspace. I sometimes even have multiple folders (and workspaces) for the same branch. Typically, I need to do a code review and I don't want to unshelve the changes to my primary development workspace, therefore I have two workspaces for the DEV branch (one for development and one for review).

    Note that I also have Visual Studio projects under branch folders.

    When I want to switch a branch, I run a script to reconfigure web.config and DynamicsDevConfig.xml.

    But there is an extra step needed and it may be a bit confusing. If I tried to use a metadata folder that contains just code that I get from source control, I would be missing all the standard stuff, such as Application Platform module. It couldn't work. I could copy the content of PackagesLocalDirectory to each branch, but it would be very slow and time-consuming. And I would have to do it again after installing an update of standard code. A better solution is creating symblic links (by a script, of course) to standard packages, which can be done in a second and it always point out to latest application.

    Here is a Powershell script to create symbolic links:

    $branchMetaDir = 'k:\Repo\Dev\Metadata'
    $packageDir = 'k:\AosService\PackagesLocalDirectory'
    
    # For each folder in packages (it assumes that there are no custom packages)
    foreach ($dir in (ls $packageDir -dir))
    {	
    	$targetDir = (Join-Path $branchMetaDir $dir.Name)
    
    	if (Test-Path $targetDir)
    	{
    		#If there is a already a folder of the same name as the symblic link, delete it
    		cmd /c rmdir /s /q $targetDir
    	}
    
    	# Create a symbolic link
        # It assumes that the Metadata subfolder already exists
    	New-Item -ItemType SymbolicLink -Path $targetDir -Target $dir.FullName	
    }

  • SaverioT Profile Picture
    330 on at

    Thanks Martin, great idea symbolic link, but is not more simple to create only one link inside PackagesLocalDirectory that point to your local folder per branch ?

  • Martin Dráb Profile Picture
    237,801 Most Valuable Professional on at

    That was my first idea too, but then I got into troubles into Visual Studio. I don't remember details, though.

    I recommend you stick to what I described. Even Microsoft uses a similar setup for Community driven engineering.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 660 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 549 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 307 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans