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 using PackOnBuild in multitargeting project, only one TFM is packed #32

Closed
kzu opened this issue Nov 25, 2020 · 1 comment
Closed
Milestone

Comments

@kzu
Copy link
Member

kzu commented Nov 25, 2020

Given a project:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFrameworks>net472;netstandard2.0</TargetFrameworks>
  </PropertyGroup>

  <PropertyGroup>
    <PackageId>TestNuGetizer</PackageId>
    <Description>Test Package</Description>
    <PackOnBuild>True</PackOnBuild>
  </PropertyGroup>
  
  <ItemGroup>
    <PackageReference Include="NuGetizer" Version="*" />
  </ItemGroup>
</Project>

Running build will result in a package that only contains netstandard2.0 libs.

Reported by @mauroa

@kzu
Copy link
Member Author

kzu commented Nov 25, 2020

This is related to the way we set up the BuildDependsOn when PackOnBuild == true. Currently, we just run Pack after build, regardless of whether the build was single or multi-targeting. This causes the Pack to run once for each TF, causing each build to overwrite the previous package and therefore leaving only the last TFM built as the package contents.

We need to account for this inner build situation and not Pack in that case, only when doing an outer build (or non-multitargeting build).

@kzu kzu closed this as completed in cc51809 Nov 25, 2020
kzu added a commit that referenced this issue Nov 25, 2020
Due to the way we were setting up the BuildDependsOn when PackOnBuild == true, we were running Pack after build, regardless of whether the build was single or multi-targeting. This caused the Pack to run once for each TF, causing each build to overwrite the previous package and therefore leaving only the last TFM built as the package contents.

This change switches to using Before/After targets and conditions instead with DependsOn for Build/Pack, as well as a mirror property to PackOnBuild, BuildOnPack to avoid building before pack (which the default behavior in SDK pack too).

Fixes #32.
@kzu kzu added this to the v0.5.0 milestone Dec 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant