我有一个类库项目文件,像这样:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="InformationLog" Version="2.1.1" />
</ItemGroup>
</Project>
我的类库有各种公共类型,例如
PublicClass1
。Nuget包InformationLog
有一个名为Log
的公共类型。我的类库需要内部使用Log
,但我不想让我的类库用户看到这个类型。我希望人们可以访问PublicClass1
,但不能访问Log
或InformationLog
中的任何其他类型或命名空间。我可以接受将
InformationLog
作为依赖项,强制引用我的类库的项目也使用InformationLog
nuget包,但我不希望该Nuget包中的类型可见。理想情况下,我希望在我的项目文件中添加一些XML来解决这个问题。像这样:
<PackageReference Include="InformationLog" Version="1.9.0" Access="Private"/>
有没有类似这样的方法可行?