how to undo pending changes of files that are unchanged? - c#

One thing that drives me crazy with TFS is the fact that if you have a file checked out, but you made no changes to it, it still shows as a change, distracting you from real changes that you made. This is especially annoying when you use tools such as T4 to generate code, because most of the time the tool will generate the same code, but will leave the file checked out.
For some reason that I can't understand, Visual Studio insists in showing those as changes, and will even claim that there are conflicts if another person happened to check-in the same "changes".
Fortunately, the TFS Power Tools include a command that compares checked-out files with the server version and undoes the unchanged files. I will explain how to integrate it into Visual Studio using a custom tool.
This is unfortunately not available if you are using Visual Studio 2017!
It used to be very simple to accomplish this with earlier versions of Visual Studio:
tfpt uu /noget /r *
How do we remove files from pending changes if they do not have any changes?

This is different based upon your choice of version control system in TFS, so the above problem only exists for TFS' traditional version control system TFVC and not git which has been supported for a few years now.
For TFVS a partial workaround is to mark all files, right-click and Undo... and click Undo Changes button in the following dialog. This will prompt you for the files that are different (letting you choose No or No to All) but not for the ones that have no changes. Important: I write 'partial' because this approach does not work for file renames as the file is considered unchanged so the rename will be undone.

Yes,there are no Power Tools for Team Foundation Server 2017. You could use below workaround:
Right-click on your project ,select undo checkout, then just click okay, or whatever confirmation is left...
Then, while undoing checkout, for every file that has REAL changes in it, a prompt will ask you to confirm the check out for that file... simply click "No to All". Visual Studio will know if the checked out file has changes or none.
WARNING: This method also removes new files, i.e. files that are not yet checked in to TFS. If you want to keep these files then simply exclude them from the set of files you "undo".
You could also take a look at this question: his question Files listed as pending changes when doing merges that didn't change?

The TFSSourceControlExplorerExtension extension is available for VS 2017 and it has an undo unchanged action that works rather nicely.

Stage the change you actually want. The file that isn't actually changed then disappears.

Related

Error or Azure DevOps Error: TF402484 The personnel team project has been deleted

VS2019 with the most recent update... Version: 16.2.5
Main error: TF402484 The personnel team project has been deleted
Also : TF10175 The personel team project does not exist.
As far as I understand so far, TFS new name seams to be "Azure DevOps". Some error say TFS while others "Azure DevOps" but it sounds like it is the same.
It got many errors in many projects (into at least 4 different solutions):
There is 3 to 4 kind of different dialog box errors, depending on where and what action I do related to TFS. All errors are about TF402484 error. The error is about a deleted project which nobody has deleted. Most of the time or always, the project has never been part of the solution.
I did not do anything else than updating my VS2019 to the most recent version.
I red: Visual studio 2013 team project has been deleted
About suggestion from previous link: "Undo any pending changes", yes it could seems to temporarily fix the bug BUT there is something that happen that put me in this situation, that seems to happen very often, intermitently and that's very anoying.
In fact, why do I have many items from other projects (not in my current solution) that appear in the Pending Changes window of my current solution?
Starting Source Control Explorer give me many TF402484 DlgBox error (at least 4) and it show "Working..." and stay like that forever. IT just freeze.
Also, I'm using many instances of VS2019 open at the same time. Could it cause the error?
What's going wrong??? What do I have to turn on/off or set, in order to prevent this behavior which is going to kill me in a near future?
Also, perhaps there is no connection, but the only other thing that also changed on my machine: I'm using Cobian Backup to do my backup and perhaps it touches (changes file time) to all or somes solution files.
The error the Undo any pending changes to that project or branches from that project in your local workspace. indicate clearly. You could give a try with below two ways:
Delete the workspace and created a new one, then check it again.
Team Explorer Home --> Under Solution --> Click the arrow down
behind workspace --> Manage Workspaces... --> Select the specific
workspace then Remove
Note: This will remove all your local mappings. Therefore you should check in all changes before deleting it. or back up
Look at Excluded Changes section under Pending Changes and check
if there are any files which belong to a deleted folder/deleted project. If yes,
right click at the file name and choose Undo.
Besides, you could try to clear TFS cache, which may do the trick.
Also reference this similar thread :
Visual Studio TFS: TF10175 During Add Solution To Source Control in
Visual Studio How To Fix
TF10175: The team project does not exists

Checkout A Project With Git And Visual Studio

I recently started using Git with Visual Studio 2015 and I'm trying to modify the properties of an installer project. The issue is that it won't let me because the project isn't checked out and I don't see an option to check out the project with Git through Visual Studio. The only place I even see the mention of the words 'Check Out' is under branches and it's grayed out.
I'm having the same problem in VS2015. It seems to be an issue with the Installer Project extension. For some reason Visual Studio doesn't detect when you attempt to change the Setup Project file (with YourProject.vdproj), and doesn't automatically unlock it for you. I had the same problem with TFS, but in that case all you had to do is manually unlock the file, by right clicking on it. I've just migrated to Git, and the problem is still there, but now you can't unlock the file by right-clicking on it (since there is no explicit check-out in git).
I'm still looking into the problem, but the only solution I've come up with now, is making a quick manual edit of YourProject.vdproj in Notepad. Visual Studio WILL recognize that edit, and unlock the file for you. After that you can continue to use IDE to make changes to the Installer project.
Unfortunately, the problem comes back once you check in your changes, and try to modify the file again. You will once more have to manually edit it to force Visual Studio to unlock it for you.
EDIT: After spending a few hours on this, I finally came up with a proper fix, which I verified works on a few in-house projects. Here are the steps:
Open your solution file in notepad, and delete the following section: GlobalSection(TeamFoundationVersionControl)
Open the solution containing locked Setup Project in Visual Studio.
Go to Tools > Options > Source Control > Plug-in Selection, and pick 'None' from the dropdown.
Click Yes to the dialog that warns you the project will be closed.
Open the solution again, you will be prompted to permanently remove
source control bindings from the projects. Click Yes to that.
You can now go back to Tools > Options > Source Control > Plug-in
Selection and pick Git again.
At this point the problem is fixed, and you will be able to modify
your Setup Project without any issues.
I found that removing bindings is clearing the values of the following tags from the project files:
<SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath>
<SccAuxPath>SAK</SccAuxPath>
<SccProvider>SAK</SccProvider>
Apparently SAK stands for 'Should Already Know'.
Here is a workaround I found,
Mark the project installer in the Solution explorer, And click "Save" (not save all).
For me it did the trick.
If it's still didn't help try to reopen VS and try the method again.
Cheers!
Open a command line, go to where you need to check it out, then issue the git checkout command? http://git-scm.com/docs/git-checkout
Like Eternal21 I encountered this problem when trying to modify an Installer project, this was in a VS2013 (rather than VS2015) project though and I could not see a GlobalSection(TeamFoundationVersionControl) in the solution file. However the following steps worked;
Go to Tools > Options > Source Control > Plug-in Selection, and pick 'None' from the dropdown.
Make the change required to the Installer project
Go back to Tools > Options > Source Control > Plug-in Selection and select Git again.
(and the Solution did not ask to be closed).
You need to create a new empty repo on your Git server first, then clone it to a folder on your local computer.
After that you will be able to add your project and check it in by adding it to the local folder.
I was able to work around this problem by simply editing the vdproj file (setup project file) manually in Notepad++ (you can use any text editor), making some temporary changes into it (type a character and backspace) and saving the file. This effectively checks out the project from GIT. Now you can come back to Visual Studio and make whatever changes you want.
I was able to use dotNETs suggestions and edit the vdproj file. Simply adding a character and removing didn't work, but making an actual edit did. Doing so triggered the check out for GIT. In my case I was attempting to change one of the Detected Dependencies exclude property to false and was able to do so while editing the vdproj file. Once I saved it then reopened Visual Studio the check was displayed on my installer and the change was already applied. I was able to make additional changes while checked out.
Once finished and I checked it in, I could no longer edit and needed to manually edit the file again to check out.

Excluding Files from TFS Server Workspace

We just implemented TFS in our company and I accidentaly included the bin and obj folders. I would like to exclude them. I searched on Google and found basically 2 ways to accomplish this:
1) https://msdn.microsoft.com/en-us/library/66tw9ezk(v=vs.90).aspx
In Visual Studio, open Solution Explorer and select the file to exclude.
On the File menu, click Source Control, then click Exclude from Source Control.
When you are ready to place the file under source control, you can access the File menu and click Source Control, then uncheck Exclude from Source Control.
In my File>Source Control, I don't see exclude from source control there or under advanced.
2) How do I permanently exclude the bin and obj folders from TFS 2012 checkin?
I tried adding a .tfignore and I couldn't find the 'ignore by extension', 'ignore file', etc. in teh Promote Candidate Changes dialog box. As far as I understand this is only applies to a local workspace and not a server workspace.
We set up the solution to checkout a file whenever it's altered, so when someone builds the project he acquires an exclusive lock on the dlls and then nobody else is able to compile.
After the steps Mike describes, you can go further and define an ignore rule. Undo the pending changes to the file you want to exclude and then click the "detected: 123" link that shows under "Excluded changes".
This open up a new window in which you can ignore these changes indefinitely. It does this by creating a .tfignore file and adding that to source control. The alternative to the UI is t create this file manually and checking it in. This should prevent Team Explorer from showing files that match the patterns in the ignore file.
Make sure that these files are deleted from source control, if they were checked in accidentally, you can destroy them to make sure they are truly gone. You'll need to do this from the commandline using tf destroy
The call to Destroy won't delete your local files when you use the remote itemspec to destroy them:
C:\>tf destroy /collection:http:
//jessehouwing:8080/tfs/DefaultCollection $/Scrum/test.txt.txt /noprompt
Destroyed: $/Scrum/test.txt.txt
C:\Program Files (x86)\Microsoft Visual Studio 14.0>dir "c:\Workspaces\Local\Scrum"
Volume in drive C has no label.
Volume Serial Number is 008A-AC5B
Directory of c:\users\jhouw\Source\Workspaces\Local\Scrum
12-08-2015 20:12 <DIR> .
12-08-2015 20:12 <DIR> ..
12-08-2015 20:12 0 test.txt.txt
1 File(s) 0 bytes
2 Dir(s) 297.229.512.704 bytes free
After performing a tf get /collection:http:
//jessehouwing:8080/tfs/DefaultCollection $/Scrum /recursive it will indeed be deleted. This should not be an issue if the files in question are regenerated during the next build.
See also:
https://stackoverflow.com/a/21260759/736079
If you're using a server workspace, the only way I can think of is to set a Forbidden Path checkin policy for your source control repo. It's a part of the Team Foundation Server Power Tools; you'd need to install the version of the power tools that matches your Visual Studio version on all developers' machines.
Note: these use Regular Expressions, so you'll need to adjust your pattern to match ;).
From my personal experience, the easiest way to achieve this is the following:
View -> Team Explorer (Ctrl+\, Ctrl+M)
Click on Pending Changes
In your Included Changes list, right click on the desired folder.
Click Exclude.
The excluded change should now appear in the Excluded Changes list below.

.csproj.user issues when checked into TFS

We made the mistake of allowing .csproj.user files to be checked in to TFS so we could set "Start external program" defaults. This worked poorly, especially when branching.
Now we're trying to undo this.
If I delete the .csproj.user file for a project and then try to set new project debug properties, I get:
TF14050: Cannot change item $/xxx.csproj.user
because it already has a pending change that is not compatible.
If I check in the delete and make changes, TFS then tries to re-add my .csproj.user file.
How can we fix this for existing projects in source control?
Update:
I think destroying them is the best option; we ended up just deleting them with the TFS Power Tools, though. The trick was to first Remove the Source Control File Type we had for *.user, even though it was already disabled. Now TFS appears to completely ignore these files.
I also wanted to check in .user files to do what the asker wanted, to provide defaults for the debug/run options. It turns out that the .user file is just another MSBuild Project XML file, and you can just "merge" the property group in there into your project. No need for .user files.
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<StartAction>Program</StartAction>
<StartProgram>$(VS100COMNTOOLS)..\IDE\devenv.exe</StartProgram>
<StartArguments>/rootsuffix Exp</StartArguments>
</PropertyGroup>
I suggest that you use the Destroy command. Be careful since it deletes permanently. MSDN documentation: http://msdn.microsoft.com/en-us/library/bb386005.aspx
Start a Visual Studio 2010 Command, and use tf.exe ...
Make sure no one has the file checked-out then delete the file - checking in as a delete and not an edit.
I use Team Foundation Power Tools and do it from the Windows Shell Context menu
After you delete a file in TFS, it isn't gone yet. You need to Check-in your deletion. Only then will the file be gone.
It's best practice to then also clean your workspace to make sure the user files don't linger as read-only files.
I use TFS Git and I was able to delete the unwanted file on the server via the TFS project site. Then I synced the local project with the server.
When you open the project to sync VS might complain that you can't sync until you commit changes to the unwanted file. This is exactly what I didn't want to do, I wanted the file to go away.
However, in the change screen I right clicked the file and said 'undo changes' and that made it go away.
After, undoing changes I was able to sync and the server removed the unwanted file from my local repository.

Visual Studio. Code changes don't do anything

Any changes I make to my code aren't doing anything. I've even tried putting lines in that I know will crash my program, and nothing. It just keep running the old version. It's even loading old versions of files I've edited and saved.
There a 3 projects in my solution. 2 are pure C#. 1 is a WinForms application.
It sometimes happens that some files "are being used by another process".
Close your solution and delete all "bin" and "obj" subfolders of all your projects that are included in the solution.
Then open your solution again, execute "Clean solution" and build it again.
Check this setting in Tools/Options, then under Projects and Solutions>Build and Run.
On Run, when build or deployment errors occur:
My personal preference is for this value to be 'Do not launch'. It will prevent Visual Studio from launching the "last successful build".
Try Ctrl+Shift+B. This will build your solution (not just a particular project). Other environments might build when you save but this needs to be explicit in Visual Studio.
Had issue with saving code changes on VS2017 (mac) Version 7.3 Preview (7.3 build 740)
Only way to get file changes to save was to do File > Save All
Doing File>Save would act like the file saved. But, when I opened the file again and no changes were saved.
Ok, you need to add more detail, but you may want to have a look at this answer:
How to enable/disable compile errors warning in Visual Studio
delete Published DLL From Bin
file names -
projectName.ddl
projectName.pdb
delete these two files and run project
I had the same problem (Visual studio 2015 is not noticing my modifications in C# XAML files).
Problem solved by deleting 2 'debug' subfolders. One in the bin folder and one in the obj folder.
I met the same problem. the code changes is not saved.(you can see from the edit it is in Yellow color. e.g. indicating changes). SAVE and BUILD will not let it save the changes. i have to wait sometime, then it could possibly save success..
Deleting the whole project and the corresponding folder from local and check out the solution again. This worked for me=> VS2017
I solved the problem like this:
1. I closed the program
2. I opened the folder that contains the file (.csproj) and opened it with Visual Studio.
Next, I chose the folder to run the command as in the image
Had the same problem. Turns out I had moved a project folder. Even when opening the solution from the moved folder and editing and saving this source code, VS 2019 was building and running a different instance of the program with the same name. Go to File-> Save yourproject.cs as..and manually walk back through the directory structure to find the instance VS is actually running. Hope this helps.
also check another option in Tools>Build and Run>Only build startup project & dependencies if you have more than 1 nested dependency, especially when using Prism or any other reflection-based frameworks that prevent "dependency detection". Also, make sure you're in the editor when using shortcuts like Ctrl+S (Save) or Ctrl+Shift+S (Save all)
Go to this location:
C:\Users\<your_system>\AppData\Local\Microsoft\VisualStudio\<studio_version>
Then remove all files and start Visual Studio.
this was the error , no changes made after build.

Categories

Resources