Package reference condition - exclude for some project
Asked Answered
A

1

1

I have the following entry in Package.props file on solution level:

<ItemGroup Label="My Label" Condition=" '$(SHFBSchemaVersion)' == '' ">
    <PackageReference Include="StyleCop.Analyzers">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
    </PackageReference>    
  </ItemGroup>

How should I edit this so that reference for StyleCop will be excluded for some project? Something like:

<ItemGroup Label="My Label" Condition=" '$(SHFBSchemaVersion)' == '' " Exclude="MyAwsomeProject">

So I would like that 'MyAwsomeProject' will not have a reference to StyleCop.

Anything answered 25/3, 2020 at 15:30 Comment(0)
A
0

I managed to get it working like this:

<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>
Anything answered 26/3, 2020 at 9:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.