Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove duplicate entries from visual studio web project?

I am working in a large team with multiple branches and merges happening on a regular basis.

One thing that happens on regular basis is that web project files end up with duplicate entries for static content (.js, favicon.ico etc...).

I have two methods to removing the duplicates:

  1. Delete the item in the Project Explorer (which removes all entries as well as the on disk file), then get the file again from source control and add it back.
  2. Unload the project file, look for the duplicates, remove them (hoping they are located near one another) then reloading the project.

Both are tedious and I am not satisfied with them - do you have a better/faster/quicker method?

like image 444
Oded Avatar asked Aug 06 '09 20:08

Oded


People also ask

How do you remove duplicates in Visual Studio?

Open Edit > Replace or use Shortcut Ctrl + H in Windows, ⌘ + Alt + F on Mac. It removes duplicate lines from the file.

How do I find duplicate codes in Visual Studio?

A very simple VS Code extension to identify duplicated lines. Select lines where you want to list the lines appearring twice or more, press Cmd+Alt+L and it will print bellow the duplicated lines.


1 Answers

The easiest way is to simply right-click on the duplicate and choose the "Exclude from Project" option. The duplicate will be disappear after refreshing the project.

like image 118
Oded Avatar answered Oct 03 '22 09:10

Oded