Pain-free local development while also referencing NuGet packages

后端 未结 7 624
青春惊慌失措
青春惊慌失措 2020-12-12 19:24

I am attempting to publish and consume versioned NuGet packages of class libraries while avoiding headaches for local development. Here is a sample Visual Studio solution la

7条回答
  •  北海茫月
    2020-12-12 19:58

    Update for .NET Core (2.x ++)

    .NET Core 2.x actually has this functionality built in!

    If you have a project reference to project A in project B, and project A is a .NET Standard or Core project with proper package information (Properties -> Package with Package id set to your NuGet package ID), then you can have a regular project reference in project B's .csproj file:

    
      
    
    

    When you pack (dotnet pack) project B, because of the Package id in project A, the generated .nuspec file will be set up with a NuGet dependency to that Package ID, together with other NuGet references you might have, instead of just including the built DLL file.

    
      
        
        
      
    
    

提交回复
热议问题