How to know full paths to DLL's from .csproj file?

隐身守侯 提交于 2020-06-27 12:17:34

问题


I wonder if there is some way to know full paths to the dll's that are listed in .csproj file.

The most interesting for me is to resolve paths to default dll's like System.Xml.dll, System.Data.dll and etc.

In the .csproj file there are only lines with short names:

<Reference Include="System.Xml.Linq">
  <RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data.DataSetExtensions">
  <RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data" />
<Reference Include="System.Xml" />

Should I look to the $PATH variable and try to resolve given dll's name ? Or what ?


回答1:


The first place you would check is the GAC. If the reference is not in the GAC, then most often there will be a relative or absolute path below the Reference like this:

<Reference Include="mydll">
  <HintPath>..\..\mydll.dll</HintPath>
</Reference



回答2:


If its any .NET library like you examples then they will generally be in the following folder: C:\Windows\Microsoft.NET\Framework\< .net version >\ or whaterver is specified in the GAC. Otherwise there will be a HintPath which will be a relative path to your current folder.



来源:https://stackoverflow.com/questions/2244881/how-to-know-full-paths-to-dlls-from-csproj-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!