Creating a NuGet Metapackage as a MSBuild Project

302 Views Asked by At

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.

0

There are 0 best solutions below