PrivateAssets='All' 是什么意思?
What does PrivateAssets='All' mean?
当我构建我的 .NET Core (NETStandard v2.0) 项目时,我收到以下警告:
ViewModels: [FodyPackageReference] Fody: The package reference for PropertyChanged.Fody
does not contain PrivateAssets='All'
该警告参考了 PropertyChanged.Fody NuGet 包。
虽然警告不会停止构建,但我想解决警告。但是,我不明白它试图传达什么。
PrivateAssets
是元数据标签,用于控制依赖资产。
You might be using a dependency purely as a development harness and might not want to expose that to projects that will consume your package. In this scenario, you can use the PrivateAssets metadata to control this behavior.
在您的情况下,除非您想向消费者公开 PropertyChanged.Fody
(即您要发布库),否则在 .csproj 文件中将 PrivateAssets
设置为 All
将删除警告。
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<PackageReference Include="PropertyChanged.Fody" Version="3.3.1" PrivateAssets="All" />
</ItemGroup>
</Project>
当我构建我的 .NET Core (NETStandard v2.0) 项目时,我收到以下警告:
ViewModels: [FodyPackageReference] Fody: The package reference for PropertyChanged.Fody does not contain PrivateAssets='All'
该警告参考了 PropertyChanged.Fody NuGet 包。
虽然警告不会停止构建,但我想解决警告。但是,我不明白它试图传达什么。
PrivateAssets
是元数据标签,用于控制依赖资产。
You might be using a dependency purely as a development harness and might not want to expose that to projects that will consume your package. In this scenario, you can use the PrivateAssets metadata to control this behavior.
在您的情况下,除非您想向消费者公开 PropertyChanged.Fody
(即您要发布库),否则在 .csproj 文件中将 PrivateAssets
设置为 All
将删除警告。
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<PackageReference Include="PropertyChanged.Fody" Version="3.3.1" PrivateAssets="All" />
</ItemGroup>
</Project>