Build NuGet Package automatically including referenced dependencies

前端 未结 4 2479
长情又很酷
长情又很酷 2020-12-02 08:05

I want to run a local/internal NuGet repository. I think I\'ve figured out how to \"reuse\" existing NuGet packages by including them in a dummy project using NuGet and sca

4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-02 09:07

    I found a well-written article on this topic. I have the same issue with certain packages that have a hierarchy of dependencies and up until now I've been uploading each as a separate NuGet package (what. a. waste. of. time)

    I've just tested the solution found here: https://dev.to/wabbbit/include-both-nuget-package-references-and-project-reference-dll-using-dotnet-pack-2d8p

    And after examining the NuGet package using NuGet Package Explorer, the DLLs produced by referenced projects are indeed present. I'm going to test by actually submitting this package to NuGet and testing it.

    Here's my source in case it is helpful to you: https://github.com/jchristn/NuGetPackTest

    And the test NuGet package: https://www.nuget.org/packages/NuGetPackTest/1.0.0

    The solution appears to work well. I don't know what it's going to look like when there are layers of references, I'm sure it could get really hairy and really fast.

    .csproj from NuGetPackTest library which references project TestLibrary (portions removed for brevity)

    
     
      
        netstandard2.0;netcoreapp3.0;netcoreapp3.1;net461
        ...
        true
    
        
        $(TargetsForTfmSpecificBuildOutput);CopyProjectReferencesToPackage
      
    
      
    
        
        
          true
          TestLibrary.dll
        
      
    
      
      
        
          
        
      
      
    
    

提交回复
热议问题