Fixed – Missing app.config (Application Configuration File) option in Visual Studio


While writing a console application we realized that the the option to add app.config was missing in Visual Studio 2019

We tried couple of things as suggested over the internet but to no avail.

Eventually, install / modify the .NET desktop development workload fixed it for us.

Application configuration file available  –

Hope it helps..

Advertisements
Advertisement

How to – Work with Git Branches in Visual Studio 2019


Continuing our previous posts, let us now see how we can work with branches within Visual Studio 2019.

Branches give the option to isolate the work from the original code base, this way we could have a developer(s) working on bug fixes, new features etc. which then can be merged back to the master branch later.

Open the Branches page in Team Explorer and click on the New Branch option.

Here we have created a new branch name MyFirstBranch from the master branch, and have also selected the option Checkout branch to work with that branch.

Create Branch creates the new branch as shown below.

To navigate to the branches page of Team Explorer, we can also use the Status bar of Visual Studio

Now let us make some changes in the program.cs file in the new branch created.

Do Commit and Push
All

From the team explorer, Branches page, we can see that the new branch has been added in the remote repository after commit.

To merge changes back from this new branch to the master branch, click on the master branch and select Merge option in the Branches page

  • Merge from Branch: MyFirstBranch
  • Into current branch: master.

As we have selected the option Commit changes after merging click on Merge pushes and sync the changes in the master branch in the remote repository as shown below.

We also have the options of deleting the branches as shown below, if they are not required anymore.

In this post, we saw how to work with Branches and how to merge it back to the base code.

Hope it helps..

Advertisements
Advertisements

How to – Perform basic Git operations with Visual Studio 2019


In the previous post,

https://nishantrana.me/2019/10/21/getting-started-with-git-repository-in-visual-studio-2019/

we learned how to setup and  get started with Git Repository in Visual Studio 2019.

In this post, we will learn how to perform some of the basic operations like commit, push, fetch, pull, etc. and how to merge the conflicts.

Let us open the solution created in the last post and make some changes

Here we have updated Program.cs and added a new class file Helper.cs


To commit these changes, we can either go to Team Explorer – Home – Changes page or click on the edit icon in the status bar of the Visual Studio.

After we have added our commit comments, we are presented with 3 different options

Commit All Commit will make a record of the changes in the local repository.
Commit All and Push Commit the changes locally and push the changes to the remote repository.
Commit All and Sync Commit the changes locally, fetch the changes from the remote repository and finally push the changes to the remote repository

We can also use the Stage option to break the commit into smaller stages

We will be presented with similar options for Commit Staged as in the case of Commit.

Perform Commit Staged and Push for both the changes.

We can see both the updates in our remote git repository

Other developers or team members who need to work in the project can Clone the project in Visual Studio 2019.

Provide the Repository location URL along with the local path.

Now suppose the developer 1 makes the below changes to the program.cs and does commit all and push.

The other developer 2, can click on Fetch in the Synchronization page to see any incoming commits.

Clicking on the commit shows the details of the changes as shown below.

Developer 2 can click on Pull to merge commits to the local master branch.

fetch Download the changes from remote repository
merge Applies the changes fetched to a branch in the local repository
pull fetch + merge

Now suppose developer 1 has changed the message and commit + push the changes to the remote repository.

And also, in parallel developer 2 has also updated the same message and has clicked on Commit and Push.

As both have made changes and referencing to the same line of code, the developer 2 gets the failure message when he tries to push his changes to the remote repository.

Message in the output window à

Developer 2 here can click on Fetch to see the changes

Developer 2 clicks on Pull to merge the changes and can see the conflict.

Clicking on Conflicts gives Developer 2 the option to Merge, Take Remote or Keep Local the changes.

Selecting the Merge option allows developer 2 the option to specify the merge.

Clicking on Commit Merge to merge the changes, followed by appropriate Commit operation to push the changes to the repository.


This resolves the conflict.

Thus, in this post, we learned how to perform basic operations like Push, Pull, Fetch, etc. and how to merge and resolve the conflicts using Visual Studio 2019.

Hope it helps..

Advertisements

How to – Getting started with Git Repository in Visual Studio 2019


Let us go through the steps to set up a Git Repository in Visual Studio 2019.

Open Visual Studio 2019

Go to Tools à Option and Set Git as source control plugin (if not set)

To create a new Repository, select Home àProjects and New Repository.

Provide the path and click on Create.

Click on the repository created to open it in the Team Explorer.

Click on Changes, which shows the files added as part of the creation of the Git Repository.

Click on Commit Staged to add the files to the local repository.

To sync it to the remote repository, we can click on Sync.

Now to add the solution to the Git Repository, back in the Home page of team explorer, click on New for the Solutions.

Follow through the Wizard. Here we have added a new solution of type Console Application to it.

Again, go back to Changes and click on Commit All.

To see the history, go to Home – Branches page, right-click on the master branch and select View history.

It shows the details of the 2 commits done locally in the local git repository.

Now to push the changes to Remote Repository

Click on Sync.

Click Publish Git Repo

Provide the URL of the Remote Repository.

Here we have created a new repository.

https://github.com/

Copy its URL.

Specify the URL and Publish the changes to the remote repository.

After successful publishing, we can see the files added in our remote GitHub repository

In Team Explorer – Home – Branches we can see the remote branch created.

To work with an existing remote repository within Visual Studio 2019, we can go to start page, select Clone or check out code option.

Either provide the URL or sign in to the GitHub account and choose the repository to clone.

Within Team Explorer also we can Clone the repository by using the Clone option

In this post, we saw how we can create a local repository, add the solution to it, publish it to the remote repository.

Hope it helps..

Advertisements

New features of Visual Studio 2019 – Code Clean up, Faster Debugging, Refactoring, Live Share


Earlier we covered below features

Let us have a look at the other new features, that are now part of Visual Studio 2019 (couple of features were available with VS 2017 as marketplace extension earlier)

Health Indicators
à With Health Indicators, which can be found at the bottom of files in Visual Studio 2019, we can quickly get a glance at how many errors and warnings are there in the file.

Code Clean up
à Along with health indicators, we can also see the icon of Code Cleanup, which allows us to apply fixes to the code.

Configure Code Cleanup settings let us define the fixes to be part of the profiles as shown below.

Code cleanup can also be run for the entire solution from Analyze à Code Cleanup

  • Debugger stepping is not 50 % faster in Visual Studio 2019 compared to Visual Studio 2017.
  • The Watch, Autos and Locals Windows are 70 % faster.
  • Font and Colors of Visual Studio 2019 can be customized through Tools à Options à Environment à Fonts and Colors


  • Indent for the parameters of the method can be specified easily


Result à


  • Signature for the parameters can be easily changed using the Change Signature dialog box

Result à

Now let us have a quick look at the most interesting feature i.e. Live Share

With Live Share, enables real-time Code Collaboration, using
we can easily share the source code/ terminal from our machine for code review or for technical help with the team members. Earlier the options were to check in the code in the repository and then asking others to get the latest or share the screen / have a meeting set up.

To get started,

Click on Live Share icon,

Select Copy Link

Here we are sharing it with one of the team members having Visual Studio Code. Live Share works with Visual Studio 2017 (with extension)/ 2019 and Visual Studio Code (with Extension) and any OS.

Click on Join Collaboration session and paste the link.

Both the users have the ability to move across the code, make changes together within their environment.

Debugging session can also be initiated/shared from both environments, without having the other user to install any specific packages/tools/plugins, etc.

Also with Live Share Extension Pack, we can add Chat and Audio Capabilities to Visual Studio Code

https://marketplace.visualstudio.com/items?itemName=MS-vsliveshare.vsliveshare-pack

That is not all, we have Live Share Whiteboard and Pomodoro extensions as well.

Check the below article that explains all the functionality of Live Share in detail

https://dev.to/lostintangent/visual-studio-live-share-in-pursuit-of-enjoyable-developer-collaboration-2nko

Hope it helps..

New features of Visual Studio 2019 – IntelliCode


IntelliCode to be very precise provides Artificial Intelligence to the code.

Basically, it will provide suggestions (AI) by displaying at the top the frequently used properties, functions, etc. as shown below.

For DateTime, IntelliCode is suggesting Now, UtcNow, MinValue and Today, as these are the ones that are used frequently.

Similar for our IOrganizationService class of Dynamics 365 CE, it suggests RetrieveMultiple, Execute, Retrieve
Update, Associate as the most frequently used methods.

To enable it.

Navigate to Tools à Options à IntelliCode

Enable the required features à

The IntelliCode gets its intelligence to give recommendations based on the huge number of open-source projects on GitHub with more than 100 stars on which it has performed machine learning and have the models defined.

The interesting part is that we can have intelliCode work for our code as well.

From within the Project, Navigate to View à Other Windows à IntelliCode Model Management.

Select Create a new model à

It will start the training and will store the generated model locally along cloud to be referred in case if working offline.

The model can be shared, deleted and retrained.

For e.g. we have the following class

And within our code, we are making use of FullName property frequently.

Now after training (retraining), it would suggest FullName as the property for our SampleClass that is being used frequently.

Get all the details here

https://visualstudio.microsoft.com/services/intellicode/

Hope it helps..

%d bloggers like this: