Prerequisites
- Visual Studio Code installed.
- Power Platform CLI installed.
- Git installed and configured.
- Access to a Dataverse environment with necessary permissions.
Step 1: Initializing a Git Repository
- In Azure DevOps go to Repos -> Files.
- Select correct repository;
- Click Clone Repo -> Clone in VS Code.
Or you can do that manually:
In VS Code, open the terminal (Ctrl+`).
Initialize the Git repository:
git init
Add the remote repository:
git remote add origin <your-repository-url>
Add a global option to exclude situations where git status will show empty modifications on files.
git config --global core.autocrlf true
Step 2: Making Changes in Dataverse Solution
- Log in to the Power Platform Dev environment.
- Navigate to Solutions.
- Open the solution you want to modify.
- Make necessary changes (e.g., adding new components, modifying existing ones).
Step 3: Extracting the Solution
Open the command prompt or terminal.
Navigate to the directory where you want to extract the solution.
Use the following Power Platform CLI command to export the solution:
pac solution export --path ".\YourLocalFolder" --name "SolutionLogicalName" --managed false
Replace
YourSolutionFolder
andYourSolutionName
with your folder path and solution name.
Step 4: Unpack the Solution
Unpack the solution to extract the solution files:
pac solution unpack --zipfile ".YourLocalFolder\SolutionLogicalName.zip" --folder ".\YourLocalFolderWithRepository\"
This command will unpack the solution into a folder where you can easily track changes.
NOTE: If you see files for which there are no changes, but git status highlights them, you need to renormalize those files. This is a safe configuration, just aligning line breaks..
git add --renormalize .
Step 5: Using VS Code for Git Operations
- Open Visual Studio Code.
- Open the folder where the solution is unpacked.
Step 6: Committing Changes
Track the changes:
git add .
Commit the changes:
git commit -m "Your commit message"
IMPORTANT NOTE:
In case of parallel work with other developers, keep a close eye on which files have been modified by you.
If the same file was changed by you and someone else, then only your changes can be picked up by selecting those changes in XML, right-clicking -> Stage Selected Ranges.
In this case, only your changes will be selected.
Step 7: Pushing Changes to Git
Push the changes to your Git repository:
git push origin YOUR_BRANCH
Step 8: Create a PR, do a review
- Go to Azure DevOps.
- Create new Pull Request for your changes.
- Add task / bug / user story number.
- Add reviewers.
- Add detail description.
- Once the review is done, your reviewers will make confirmation of the changes and your changes will end up in the main branch.
Conclusion
You have successfully made changes in the Dataverse solution, extracted them using Power Platform CLI, and pushed these changes to your Git repository using VS Code.
*Summary*
No comments:
Post a Comment