DEV Community

Discussion on: [C#] including 3rd DLL file to nuget package

Collapse
 
julianchu profile image
Julian-Chu

hi Tony, sorry for late reply. I don't know your project detail. I must say it's weird if dll is already inside nuget package, maybe clean nuget cache or publish new version nuget package can help.

Collapse
 
vasar007 profile image
Vasily Vasilyev

I faced the same issue as Tony. The issue was resolved by deleting node <PackagePath />. My final configuration:

 <ItemGroup>
    <Content Include="$(SolutionDir)Libraries\lib.so">
      <Pack>true</Pack>
      <BuildAction>None</BuildAction>
      <PackageCopyToOutput>true</PackageCopyToOutput>
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
  </ItemGroup>
Enter fullscreen mode Exit fullscreen mode

If node <PackagePath /> exists, file will be added to NuGet package. However, this file cannot be copied to the output directory during build process of some project which includes such NuGet package. Also you can check autogenerated NuGet specification here:

C:\Users\USERNAME.nuget\packages\PACKAGENAME\VERSION\PACKAGENAME.nuspec

If there are no <contentFiles /> node, then your file will not be copied to the output directory. You should remove <PackagePath /> or disable autogeneration of NuGet specification and write it by youselft and specify files to copy.