NuGet auto package restore does not work with MSBuild

后端 未结 12 2308
粉色の甜心
粉色の甜心 2020-12-02 08:51

I\'m trying to build a solution with packages content missing (except repositories.config inside) with MSBuild 12.0. I expect it to auto restore al

12条回答
  •  甜味超标
    2020-12-02 09:32

    MSBuild 15 has a /t:restore option that does this. it comes with Visual Studio 2017.

    If you want to use this, you also have to use the new PackageReference, which means replacing the packages.config file with elements like this (do this in *.csproj):

    
      
      
      
    
    

    There is an automated migration to this format if you right click on 'References' (it might not show up if you just opened visual studio, rebuild or open up the 'Manage NuGet packages for solution' window and it will start appearing).

提交回复
热议问题