New Visual Studio Solution Tutorial
Creating a new solution in Visual Sudio
1. First create a new workspace. To do this correctly, Visual Studio must have been closed with no solutions open. Having a solution automatically open when Visual Studio is opened sets a default workspace. To properly set the workspace in step 2c you must not have an existing default workspace.
- Open the “Manage workspaces” window (File->Source Control->Workspaces or from the Source Control Explorer or Pending changes window).
- In the Source Control Explorer or Pending changes window look for the drop down list to the right of Workspace:, go to the bottom select workspaces …
- A window pops up showing you all the workspaces on your machine and will look similar to this image
- Add a new workspace. Make sure to pick different names for the the workspace and the solution. This will make it easier to debug if there is a Visual Studio problem later. I use <version> <SF name> for my workspaces and <SF name > <version> for my solutions. Note that "server" is not changeable. It is the location of the source control server, NOT the location of the web server.
Select the source control folder and the local folder and fill in the comment with the contents of the workspace.
2. Now create a new solution. (File → New → Project) Under “Other Project Types” select “Visual Studio Solutions” and “Blank Solution”.
- Be sure to rename the solution now
- The new solution should appear in the Solution Explorer and be empty.
- Add the first project. (Normally the file specific project). (File → Source control → Add project from source control. If the workspace is greyed out when you are adding your first project, there was a default workspace already set. (Most likely because there was a solution open when you last closed Visual studio). Close and delete this new solution, close and re-open Visual Studio and start over at step 2. If you have correctly created your solution, select the correct vbproj or dbproj file. The local file path will be automatically set by the selection of the correct workspace.
• After creating the solution and adding the first project from source control. Your Solution explorer should have an expanded view of the added project with the project highlighted. Before adding your next project, be sure you have selected your SOLUTION. If you accidentally add a project while the previous project is selected. Delete the solution and create a new one. It is very difficult to detangle the solution. (To delete a solution you will need to go the directory where you have stored your Visual Studio solutions and delete it from there.)
• Keep adding projects until all the necessary projects have been added. After the first project has been added to a solution, you will no longer be able to select a workspace. There is only one workspace associated with a solution. If you can not add a project because there is no local path found, it means you forgot to add that project to your workspace. Go back and edit the workspace adding the missing project and then return to adding projects to your solution. You do not need to start over for this error. Be sure to select the solution again after each project is added!
3. Now that your solution has been created, you must set the properties for it and each project it contains. Right click on on the Solution. Go to the Bottom and select properties. The important solution properties are: • Single startup project.
• Project dependancies – Files specific on common, common and SQL on nothing.
• Configuration – do not build or deploy the SQL project.
4. Change and select the Specific project, right click, scroll to the bottom and select Properties. The important project properties are: • On the Web tab for the file specific project under Start Action select Specific Page and set on Default.aspx, NEVER apply server settings to all users (you’ll mess up other people’s solutions) and select the appropriate debuggers. You may only need ASP.NET or you may need more types. On the Package/Publish Web page the default setting should be correct but should be checked. You want to
INCLUDE generated debug symbols, and EXCLUDE files from the App_Data folder. SAVE
• On the Web tab for the common project, select "Don't open a page" and the appropriate debuggers. SAVE
• No properties need to be edited for the SQL project.