简体   繁体   English

csproj文件中下面的两个有什么区别?

[英]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. 这意味着Visual Studio将其作为项目包括为代码。 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. 如果更改WindowsApplication2 ,则将重新构建它,并将生成的DLL文件复制到解决方案中所有从属项目的输出文件夹中。

In case 2, you simply have a reference to a generated DLL file. 在情况2中,您只需引用一个生成的DLL文件。 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. 这是一个生成的程序集,这意味着没有代码,没有可能进行编辑,如果没有.pdb文件等则也没有可能对其进行调试。这还意味着您每次制作时都必须构建和更新DLL文件。改变它。

I may be wrong, but it won't compile if you have both of these references in your project. 我可能是错的,但是如果您的项目中同时包含这两个引用,它将无法编译。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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