When you need to exclude a file in a project from source control, you can select that file in the Solution Explorer window, then go to File > Source Control > Exclude [filename] from Source Control. A red icon should appear to the left of that file in the Solution Explorer window to tell you that it’s excluded from source control. This option doesn’t show up in the context menu of the file, just as other options that only show up in File > Source Control. Another way to do that is to add the file to the project, then undo the “Add” pending change for that file. It will remain in your project but it won’t be added to Source Control.
Class1.cs is excluded from Source Control while Class2.cs is added to project but not added to source control.