Search code examples
visual-studio-2010version-controltfsprojects-and-solutions

Visual Studio 2010: How to modify a newly added project before checking anything in?


I'm working in a team of developers on a Visual Studio 2010 solution. We are using TFS and the Source Control that comes with that.

I can't check in something that won't compile.

I am needing to add some existing projects to the solution from another solution. First I need to add them to this solution, then fix some references and namespaces so the solution will compile, then check all that as a completed unit of work back into Source Control.

I copied the existing projects' folders into the solution's folder first (in the OS, not in VS).

What is happening, is that when I add the existing projects to the solution, it only adds a node for the project, with a plus icon for Source Control. It ignores these items in the compile. The code files for the added projects are not yet actually in the solution. I can't fix anything at this point.

The only way it seems Visual Studio is giving me to proceed is to check in the newly added projects to Source Control, then make my fixes, then do another check in for the fixes.

This is not cool because it would break the solution in Source Control and my team mates' code. Plus checking in creates an automated build. It's a big deal.

Is there a work around? Thanks!

EDIT: I added the projects by dragging and dropping the csproj files from the OS into the Solution Explorer. They show up as file names, not as project names, along with the .csproj file extension. It's as if Visual Studio thinks I wanted to add the files, not the projects.


Solution

  • I would highly suggest you speak to an existing team member to get some help on how to attach existing projects to your solution.

    A few generalities though:

    I copied the existing projects' folders into the solution's folder first (in the OS, not in VS).

    Typically, this is NOT the way to do things. Normally you don't just copy another projects folder into yours. Either you simply attach that project to your solution from its existing location OR it gets branched into your own solution structure. Either way copying it around breaks the source control links which is usually not the desired behavior.

    EDIT: I added the projects by dragging and dropping the csproj files from the OS into the Solution Explorer. They show up as file names, not as project names, along with the .csproj file extension. It's as if Visual Studio thinks I wanted to add the files, not the projects.

    To add an existing project to your solution right click on the solution and select Add -> Existing project... All you've done is added a FILE to your project which has no meaning; that won't work.

    The only way it seems Visual Studio is giving me to proceed is to check in the newly added projects to Source Control, then make my fixes, then do another check in for the fixes.

    I'm not sure why you think this. Either the solution compiles or it doesn't. Checking it into source control will not impact this. Most likely the compilation problems are due to issues I identified above.

    Either way, talk to an existing team member (or manager) to help you properly set up your solution. It's going to be the easiest way. I know that if one of my guys was having problems with TFS I would much rather they speak to me early so that I could show them how it works.