包引用条件-排除某些项目



在解决方案级别的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>

最新更新