For those well-versed in DevOps, this task is a breeze, straightforward and uncomplicated. However, for many others, it remains an unfamiliar and challenging path that we aim to shed light on.
This guide addresses common challenges encountered during the interaction between DevOps and Visual Studio, specifically focusing on scenarios where reuploading a new version of a project to our DevOps repository or simply starting work on the project that the source code is in DevOps.
In our scenario, we have been working on a project offline due to the initial lack of access to DevOps, and now that access is fixed, several weeks have passed, and we need to update the code in DevOps.
Now that we have identified the “issue”. To solve it (at least one way to do it), we have to:
- Open your Visual Studio, and on the Get started window, select the option Continue without code.
- Once the main Visual Studio opens, open or access the Git Changes window panel and select the Clone Repository… option.
- A new window titled Clone a repository will open.
- Now, from our DevOps portal, access the solution repository and click on the Clone button.
- Copy the generated HTTPS URL.
- This will open a panel with several options, including the Git repository URL that we need.
- Paste the copied Git repository URL into the Clone a repository window inside Visual Studio for the Repository location property.
- Make sure you specify a correct local path.
- Next, click Clone.
If you want, you can close Visual Studio now.
Now that we have the repo cloned in our machine, we can update the files with our changes.
- Transfer the solution files with the changes. You can simply copy and paste all your solutions into the location we set up to have the repo clone; you can and should exclude the Git-related files.
- You will notice that the new repository already has some files there.
Now that we have replaced/updated the old files present in DevOps with the new ones containing all our changes, we need to sync them to the DevOps repo. To do that, we need to:
- Open the Visual Studio solution you just copied. It is now located in the new folder we created as a repository.
- Once the Visual Studio opens, open or access the Git Changes window panel.
- On the Git changes window:
- On the text window, enter a descriptive message for the changes you are making.
- Then, click on the arrow next to Commit All to open a dropdown menu.
- And finally, choose the Commit All and Push option.
- The project will now be successfully pushed into the new DevOps repository.
Hope you find this Developer Tip helpful! If you enjoyed the content or found it useful and wish to support our efforts to create more, you can contribute towards purchasing a Star Wars Lego for Sandro’s son!