0
 <ItemGroup>
    <ProjectReference Include="..\WindowsApplication2\WindowsApplication2.csproj">
      <Project>{7CE93073-D1E3-49B0-949E-89C73F3EC282}</Project>
      <Name>WindowsApplication2</Name>
    </ProjectReference>
  </ItemGroup>

  <ItemGroup>
    <Reference Include="WindowsApplication2, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
      <SpecificVersion>False</SpecificVersion>
      <ExecutableExtension>.dll</ExecutableExtension>
      <HintPath>..\WindowsApplication2\bin\Release\WindowsApplication2.dll</HintPath>
    </Reference>   
 </ItemGroup>
Liam
  • 27,717
  • 28
  • 128
  • 190
Yaswanth
  • 59
  • 1
  • 10

1 Answers1

2

The difference is that in one case you have a project reference. It means that Visual Studio includes it as a project, as a code. You can work with it in your solution, you can modify its code. If you change WindowsApplication2, then it will be rebuilt and generated DLL-files will be copied to all dependent projects' output folders within solution.

In case 2, you simply have a reference to a generated DLL file. It is a generated assembly, which means no code, no possibility to edit it, no possibility to debug it if there are no .pdb files etc. It also means that you will have to build and update your DLL-file every time you make changes to it.

I may be wrong, but it won't compile if you have both of these references in your project.

Yeldar Kurmangaliyev
  • 33,467
  • 12
  • 59
  • 101
  • When I click on Reference I can only add DLLs not csproj!! I can add csproj to only solution(sln) file right? can I add csproj to a project and not to a solution? – Yaswanth Nov 13 '15 at 11:02
  • @Yaswanth You should read this question [Difference between project and dll dependencies in .Net in the final compiled assembly](http://stackoverflow.com/questions/3714686/difference-between-project-and-dll-dependencies-in-net-in-the-final-compiled-as) – Liam Nov 13 '15 at 11:04
  • and this [VS Solution, projects vs dlls best practice](http://stackoverflow.com/questions/271828/vs-solution-projects-vs-dlls-best-practice) – Liam Nov 13 '15 at 11:05
  • @Yaswanth Yes, you need to either include this project into your solution or reference it as DLL. – Yeldar Kurmangaliyev Nov 13 '15 at 11:05
  • @Yeldar Kurmangaliyev : If I include in solution then I will see it as a part of .sln file but I wont see it as a part of csproj but in my project I saw this in csproj and I am not able to figure out what exactly it is – Yaswanth Nov 13 '15 at 12:00
  • @Liam : Thanks Liam for the references. – Yaswanth Nov 13 '15 at 12:00