Skip to content

When inferring content, PackInference.PackExclude isn't properly evaluated #128

@kzu

Description

@kzu

We're currently including items for inference with the following (somewhat esoteric) MSBuild:

<InferenceCandidate Include="@(%(PackInference.Identity))" Exclude="@(%(PackInference.Identity) -> '%(PackExclude)')"/>

What this does is evaluate the identity of each PackInference so that the Include contains, for example, @(Content). Since the Include attribute does not contain actual item specs, the Exclude isn't actually filtering out anything, causing this basic extensibility point in nugetizer to malfunction.

Discussed in #120

Originally posted by quasarea June 29, 2021
Hi,

I have library that depends on Grpc.Core package. This package has a targets file that adds assemblies to output

...
  <ItemGroup Condition="'$(Grpc_SkipNativeLibsCopy)' != 'true'">
    <Content Include="$(MSBuildThisFileDirectory)..\..\runtimes\win-x86\native\grpc_csharp_ext.x86.dll">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
      <Link>grpc_csharp_ext.x86.dll</Link>
      <Visible>false</Visible>
    </Content>
...

How can I exclude grpc_csharp_ext.x86.dll from being packaged? I have tried several combinations of

    <PackInference Update="Content" PackExclude="**/grpc_csharp_ext.x86.dll;**/grpc_csharp_ext.x64.dll" />
    <PackInference Update="Content" PackExclude="$(OutputPath)/**/grpc_csharp_ext.x64.dll" />
    <PackInference Update="Content" PackExclude="$(OutputPath)/grpc_csharp_ext.x64.dll" />
    <PackInference Update="Content" PackExclude="**/grpc_csharp_ext.x64.dll" />

But nothing worked :(

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions