Search code examples
c#wpfvisual-studiopack

Pack project WPF, the library is missing class and method


I have three project. A B C. A have reference to B, and B have reference to C. I do pack on project A.

I added this to A.csproj to copy other dll to nuget:

<PropertyGroup>
    <TargetsForTfmSpecificContentInPackage>$(TargetsForTfmSpecificContentInPackage);SetCustomFilesToPackage</TargetsForTfmSpecificContentInPackage>
</PropertyGroup>
<Target Name="SetCustomFilesToPackage">
    <ItemGroup>
        <TfmSpecificPackageFile Include="bin\$(Configuration)\$(TargetFramework)\*.dll">
            <PackagePath>lib/net461</PackagePath>
        </TfmSpecificPackageFile>
        <TfmSpecificPackageFile Include="bin\$(Configuration)\$(TargetFramework)\**\*.dll">
            <PackagePath>lib/net461</PackagePath>
        </TfmSpecificPackageFile>
    </ItemGroup>
</Target>

When I browse nuget all dll files are in it. But when I use this nuget in other project there are missing whole class or some method form project B and C.

Why is it happen?

Edit:

I also noticed that library "B" fell into Dependencies when I open a nuget. And when I enter the classes that exist for "B" and "C", they have version 1.0.9, despite the fact that I do not currently version these projects. And project "A" has version 1.0.48.


Solution

  • I solved the problem by adding "C" to the project reference "A" and setting PrivateAssets = "All" for ProjectReference. The result is that they don't show up in Dependency nuget's and work.