Moving files from one Visual Studio solution to another

Berryl picture Berryl · Feb 3, 2010 · Viewed 33.3k times · Source

What I usually do is create a new file in the solution where I want to use it (same name), copy & paste the contents of a class from the source solution to the target, fix the namespace & imports as needed.

The only other way I know to do it is open the source file in the target solution and then just save a copy into that folder, which can get confusing with two files open with the same name in one solution.

Does anyone have an easier way to do this?

Answer

Jay picture Jay · Feb 3, 2010

You can just copy and paste the files themselves.

When you have your solution open, look at the top of the solution explorer and you'll see an icon that looks like a page with a page outline behind it and a yellow page (not a very intuitive icon). This is the "show all files" button. Click that and you'll see all the files in your currently selected project (it is project-specific). Highlight any files that you want to include, right-click, and select "Include in Project."

enter image description here