软件包参考条件-某些项目不包括 [英] Package reference condition - exclude for some project

查看:51
本文介绍了软件包参考条件-某些项目不包括的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在解决方案级别的Package.props文件中具有以下条目:

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>

我应该如何编辑它,以便在某些项目中不包含StyleCop的引用?像这样:

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">

所以我希望'MyAwsomeProject'没有对StyleCop的引用.

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

推荐答案

我设法使它像这样工作:

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>

这篇关于软件包参考条件-某些项目不包括的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆