In my project that gets deployed as a NuGet package, I depend on another package, and that has to be deployed with my package, but I don't want the users of my package to have to explicitly list that second package as they never explicitly use it. I did this in my csproj file:
<ItemGroup>
<PackageReference Include="PumlGenerator.Attributes" Version="1.2.0" PrivateAssets="all" />
<None Include="$(NuGetPackageRoot)PumlGenerator.Attributes\1.2.0\lib\net9.0\PumlGenerator.Attributes.dll" Pack="true" PackagePath="lib\net9.0" />
</ItemGroup>
If I dotnet pack
it completes successfully and I can publish it. However, once I try and make that happen via a github action, I'm getting this failure:
/usr/share/dotnet/sdk/9.0.101/Sdks/NuGet.Build.Tasks.Pack/build/NuGet.Build.Tasks.Pack.targets(221,5): error : Could not find a part of the path '/github/home/.nuget/packages/PumlGenerator.Attributes/1.2.0/lib/net9.0'.
Why is it that building manually writes that PumlGenerator.Attributes.dll
into the ~/.nuget/packages
directory, but when it builds via a GitHub action it doesn't end up there?
This is the job in the workflow:
jobs:
merge:
container: mcr.microsoft/dotnet/sdk:9.0
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build
run: dotnet pack -p:Version=${{ github.event.release.tag_name }}
dotnet nuget --version
says 6.12.2.1