Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
kzu opened this issue Jul 19, 2021 Discussed in #120 · 0 comments · Fixed by #129
Closed

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

kzu opened this issue Jul 19, 2021 Discussed in #120 · 0 comments · Fixed by #129
Labels
bug Something isn't working

Comments

@kzu
Copy link
Member

kzu commented Jul 19, 2021

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 :(

@kzu kzu added the bug Something isn't working label Jul 19, 2021
kzu added a commit that referenced this issue Jul 19, 2021
We were previously assuming Exclude was a valuated while doing the Include for entire item groups, while this is not the case. We need instead to evaluate using the same MSBuild syntax (we use minimatch for this) so we can properly exclude items.

Fixes #128.
kzu added a commit that referenced this issue Jul 19, 2021
We were previously assuming Exclude was a valuated while doing the Include for entire item groups, while this is not the case. We need instead to evaluate using the same MSBuild syntax (we use minimatch for this) so we can properly exclude items.

Fixes #128.
kzu added a commit that referenced this issue Jul 19, 2021
We were previously assuming Exclude was a valuated while doing the Include for entire item groups, while this is not the case. We need instead to evaluate using the same MSBuild syntax (we use minimatch for this) so we can properly exclude items.

Fixes #128.
kzu added a commit that referenced this issue Jul 19, 2021
We were previously assuming Exclude was a valuated while doing the Include for entire item groups, while this is not the case. We need instead to evaluate using the same MSBuild syntax (we use minimatch for this) so we can properly exclude items.

Fixes #128.
kzu added a commit that referenced this issue Jul 19, 2021
We were previously assuming Exclude was a valuated while doing the Include for entire item groups, while this is not the case. We need instead to evaluate using the same MSBuild syntax (we use minimatch for this) so we can properly exclude items.

Fixes #128 and #122.
@kzu kzu closed this as completed in #129 Jul 19, 2021
kzu added a commit that referenced this issue Jul 19, 2021
We were previously assuming Exclude was a valuated while doing the Include for entire item groups, while this is not the case. We need instead to evaluate using the same MSBuild syntax (we use minimatch for this) so we can properly exclude items.

Fixes #128 and #122.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant