包参考条件 - 排除某些项目
Package reference condition - exclude for some project
我在 Package.props 文件中的解决方案级别有以下条目:
<ItemGroup Label="My Label" Condition=" '$(SHFBSchemaVersion)' == '' ">
<PackageReference Include="StyleCop.Analyzers">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>
我应该如何编辑它以便在某些项目中排除对 StyleCop 的引用?类似于:
<ItemGroup Label="My Label" Condition=" '$(SHFBSchemaVersion)' == '' " Exclude="MyAwsomeProject">
所以我希望 'MyAwsomeProject' 不会引用 StyleCop。
我设法让它像这样工作:
<ItemGroup Label="My Label" Condition=" '$(SHFBSchemaVersion)' == '' And '$(AssemblyName)' != 'MyAwsomeProject'">
<PackageReference Include="StyleCop.Analyzers">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>
我在 Package.props 文件中的解决方案级别有以下条目:
<ItemGroup Label="My Label" Condition=" '$(SHFBSchemaVersion)' == '' ">
<PackageReference Include="StyleCop.Analyzers">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>
我应该如何编辑它以便在某些项目中排除对 StyleCop 的引用?类似于:
<ItemGroup Label="My Label" Condition=" '$(SHFBSchemaVersion)' == '' " Exclude="MyAwsomeProject">
所以我希望 'MyAwsomeProject' 不会引用 StyleCop。
我设法让它像这样工作:
<ItemGroup Label="My Label" Condition=" '$(SHFBSchemaVersion)' == '' And '$(AssemblyName)' != 'MyAwsomeProject'">
<PackageReference Include="StyleCop.Analyzers">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>