Far Away Developer

Sebastien Lachance

Visual Studio 2005 : Adding projects to your solution

Posted by Sebastien Lachance on October 11, 2007

There is 2 ways :

1. Begin by opening the New Project dialog box : File/New/Project… (or Ctrl-Shift-N). Navigate to the type of project you want. In the solution dropdown, choose Add to Solution. Failure to do that will result in the creation of a new solution. Enter the name of our project and click the OK button.

AddToSolution

2. In the Solution Explorer (Ctrl-Alt-L), right-click on the solution node and choose Add/New Project…

AddNewProject2

This time you don’t need to choose anything in the dropdown. Enter the name of the project and click the OK button.

Each one of those 2 methods will a a new folder with the name you entered. Inside the folder you will find a project file (.csproj or .vbproj) and a .cs (or .vb). By default Visual Studio will generate a default file for the type of project you choose).

Let’s look at the project file.

<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProductVersion>8.0.50727</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>c50693b9-547b-49f0-8850-e3c0a3b0325c</ProjectGuid>
    <OutputType>Library</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>ClassLibrary1</RootNamespace>
    <AssemblyName>ClassLibrary1</AssemblyName>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.Data" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="Class1.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
  </ItemGroup>
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>

As you can see, it’s an xml file. It contains informations about the assembly name, the output type, namespace, version of Visual Studio used to create the project, etc. And it also contains the information used to compile. This is a whole topic so we will not cover it now. Right under we have the reference used by the project and the files it contains . You do not need to remember all that, the important thing is to know what is the purpose of the file. And finally, if you decide to use SourceSafe, all binding information will be added to this file.

3 Responses to “Visual Studio 2005 : Adding projects to your solution”

  1. target » Blog Archive » Visual Studio 2005 : Adding projects to your solution Says:

    [...] Read the rest of this great post here [...]

  2. Linus Miller Says:

    What if i cannot see the solution node in my solution explorer? Even if i start a new project i cannot see the solution node… help please

  3. Sebastien Lachance Says:

    I have done a post that answers this question today. Solution here.
    I this is not what you intented, just let me know and I’ll correct it.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>