简体   繁体   中英

What is the difference between the below two in csproj file?

 <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>

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM