Pain-free local development while also referencing NuGet packages

后端 未结 7 636
青春惊慌失措
青春惊慌失措 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:51

    My not-so-clean yet fastest solution so far is:

    Assuming the following two separate solutions:

    VS Solution 1: contains libraries published as nuget packages:

    Solution1
    |_ my.first.library
    |_ my.second.library
    

    VS Solution 2: contains applications, which consume one or more of the above libraries as PackageReferences:

    Solution2
    |_ my.first.application
    |  |_ depends on nuget my.first.library (let's say v1.0.1)
    |
    |_ my.second.application
    

    In case, I'm making changes to my.first.library

    I proceed as follows:

    1. Make code changes to my.first.library and rebuild
    2. Navigate to the build output directory of my.first.library (e.g. /my.first.library/bin/debug/netstandard2.0) and copy the .dll and .pdb files
    3. Navigate to the my.first.library's local directory of the currently being used nuget feed (for example at: C:\Users\user.name\.nuget\packages\my.first.library\1.0.1lib\netstandard2.0) and replace the .dll and .pdb files there with the ones generated in step 1 (possibly making backup).
    4. Changes get reflected in my.first.application. Continue working and repeat steps 1-4, when needed

    Advantages:

    • being completely local. No secondary nuget feeds needed.
    • zero changes to .csproj/.sln files

提交回复
热议问题