0

This question is a followup to an earlier question and subsequent questions raised by research on MSDN per the links provided in the answer.

Here's an image of the solution explorer I've set up so far & I want to make sure I'm on the right track organizationally.

enter image description here

First, because VS2010 is for a C# Class I'm taking, I'm organizing a ProgrammingClass solution (ITDEV110) and Assignment projects (ASSN3a, ASSN3b) within that solution. I read somewhere that a solution is like a house and a project like a room...so this makes good organizational sense to me.

Given that organizational strategy, I can't find the best way to save a copy of Assignment1 as the basis of Assignment2. Sometimes I get proj2's *csproj file in the proj2 path, but the *cs files in the proj1 path. Other times, my *cs files show up in solution explorer as a dotted outline icon (not the *._cs in the pic). I can still click, edit and save, but they still look like ghost classes in explorer--and I'm not sure what that dotted ghost line means to the compile and run.

So how can I move *cs files between projects in a single solution without

  1. confusing VS2010 into thinking it has two Mains, and
  2. ensuring the right versions of classes and methods are called?

Is it just a matter of "Save As..." a new project name? Or should I create a new project from existing code? Is this a job for namespaces? How does this differ if I want SOME of the code from #1 to BE accessible from #2?

I've been doing a lot of creating new classes for my programs by cutting-pasting from notepad...but I know there's got to be a better way.

Any resources or tips would be awesome.

Community
  • 1
  • 1
dwwilson66
  • 6,806
  • 27
  • 72
  • 117
  • FYI, one question per question – John Saunders Mar 12 '13 at 03:50
  • @JohnSaunders Copy that. Amended to reflect the assumption that my organizational strategy is good. If it isn't I'm sure someone will tell me I'm out of my gourd even if I hadn't asked. :) – dwwilson66 Mar 12 '13 at 03:57
  • Side note: shortening "assignment Number 3" down to "3 letters + n3" will look non-professional, and while bring some laughs from your friends may not work very well when someone reads it aloud when checking your code. – Alexei Levenkov Mar 12 '13 at 04:11
  • @AlexeiLevenkov: agreed...but that's how the instructor gives them to us & wants them back. :\ Personally, I prefer something meaningful like `GetSetExercise` or `CreateMyOwnClass`. – dwwilson66 Mar 12 '13 at 13:27

1 Answers1

2

Create a new different C# project for each programming assignment you get. Feel free to use the same Solution, but it's best to keep projects separate. It is possible to share files between projects (using Linked files), or references types and classes from other projects using Project References, but putting school work code into the same C# project is a lesson in pain.

Dai
  • 141,631
  • 28
  • 261
  • 374
  • +1. Also consider finding, learning and using a source control system. You'll have to do it at some point anyway - so if you start earlier you'll spare your town from waking up in the middle of the night from you "@@@@!!!!" when you loose your assignment night before its due. – Alexei Levenkov Mar 12 '13 at 04:28
  • @AlexeiLevenkov: source control sounds like it ~would~ help me a lot. Do you have any reommendations? I know there's one in VS2010 that I can switch on, but I seem to recall that it needs to be on a Project Server...which I don't have. :( – dwwilson66 Mar 12 '13 at 13:29
  • @dwwilson66, [Subversion (also known as SVN)](http://en.wikipedia.org/wiki/Subversion_(software)), GIT, TFS - check what people around you know or if your school have recommendations. [Hosted TFS - free up to 5 users](http://tfs.visualstudio.com/en-us/pricing/information) maybe good option too with more integration to VS. – Alexei Levenkov Mar 12 '13 at 16:32