Use a .nuspec file/script to automatically install nuget packages into a new project

前端 未结 2 1395
长情又很酷
长情又很酷 2021-01-26 13:47

I am trying to automate the process of installing nuget packages into new visual studio projects. My idea is to reduce the time it takes to source all the packages via the nuget

2条回答
  •  难免孤独
    2021-01-26 14:21

    note that you cannot simply drop a pre-built packages.config file into a new project and expect it to work. When installing, NuGet modifies the project file (.csproj) to include references and uses packages.config for downloading missing files (and update/conflict logic).

    Using VS 2017 (released stable versions 15.2 and higher) and the PackageReference style of referencing projects, you can simply drop a Directory.Build.props file into the root of your solution containing all the projects you need:

    
      
        
                                                            
提交回复
热议问题