2

Is there any real way to create a NuGet metapackage as an msbuild .proj instead of directly using a nuspec? I want to do this so I can leverage other MSBuild functionality including PackageVersioning, including content files, etc.

What I mean is that I want to have a simple project for my metapackage (let's say MyMetaPackage.proj:

<Project>
      <Import Project="$(MSBuildSDKsPath)\NuGet.Build.Tasks.Pack\build\NuGet.Build.Tasks.Pack.targets" />
    <ItemGroup>
        <PackageReference Include="Microsoft.Azure.WebJobs" Version="3.0.0-beta5" PrivateAssets="None" />
        <PackageReference Include="Microsoft.Azure.WebJobs.Extensions" Version="3.0.0-beta5" PrivateAssets="None" />
        <PackageReference Include="Microsoft.Azure.WebJobs.Extensions.Http" Version="3.0.0-beta5" PrivateAssets="None" />
        <PackageReference Include="Microsoft.Azure.WebJobs.ServiceBus" Version="3.0.0-beta5" PrivateAssets="None" />
        <PackageReference Include="MyOtherPackage" Version="4.5.0" />
        <Content PackagePath="readme/$(PackageVersion).txt" Include="readme.txt" />
    </ItemGroup>
</Project>

The problem with this is that MyMetaPackage.nupkg ends up having all contentFiles and customs props/targets imported into it that screw it up, even though it's only meant to be a metapackage - those things should only be done for the CONSUMERS of MyMetaPackage.

Adding PrivateAssets to MyMetaPackage.proj isn't at all helpful, because then the nuspec excludes them as well and they won't be passed on to the consumers either.

Jeff
  • 35,755
  • 15
  • 108
  • 220
  • Could you explain in more detail? I don't understand this idea. – UserName Aug 19 '18 at 22:21
  • A meta package is just a package of packages for convenience and contains no or minimal content itself. I have 5 dependent packages and a couple of content files I want to include. See about a meta package: https://www.google.com/amp/s/andrewlock.net/what-is-the-microsoft-aspnetcore-metapackage/amp/ – Jeff Aug 19 '18 at 23:11

0 Answers0