Create nuget package with multiple DLLs

后端 未结 8 1722
忘了有多久
忘了有多久 2020-12-25 09:58

Let\'s say I have a project with this structure:

MyLibrary\\
  MyLibrary.sln
  MyLibrary.Core\\
    MyLibrary.Core.csproj
  MyLibrary.Extensions\\
    MyLibr         


        
8条回答
  •  悲&欢浪女
    2020-12-25 10:24

    You'll run NuGet on a single project (or nuspec file), but it supports pointers to other projects via the file element. This element uses the names of your project's References, so you avoid having to a) find the location of other project files, and b) copy files to a particular place as a post-build step.

    Supposing you have a nuspec file for MyLibrary.Core.csproj, and it references MyLibrary.Extensions and MyLibrary.Tests such that they end up in the bin directory after a build:

    
      
        ...
      
      
        
        
      
    
    

    With this setup, all of your references should end up in the appropriate place in the NuGet package. You still have the hard-coded 'Release' in there, but I'd wager most probably don't distribute NuGet packages of their debug builds anyway.

提交回复
热议问题