views:

198

answers:

2

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?

+2  A: 

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."

Jay
suh-wwheet. Thanks!
Berryl
+2  A: 

You could just copy the file with Explorer. Or better yet, start refactoring your projects so that you'll create assemblies that are usable by multiple client projects.

Hans Passant
agreed. i commented on your last answer about assembly names to see you you had any approaches to refactoring assemblies. I don't know of a Resharper or other offering that does this painlessly.
Berryl
Right, the tool you need for that is the one between your ears.
Hans Passant
Yeah, I do tend to forget that one is sometimes available :-)
Berryl