The command “C:\Main\Src\.nuget\nuget.exe restore -SolutionDirectory ..\” exited with code 1

后端 未结 1 1313
日久生厌
日久生厌 2021-01-24 21:00

I\'ve been struggling with getting NuGet to work for well over a week now. I finally got it to work on local builds, but not on TFS 2013 builds. I narrowed it down to NuGet not

相关标签:
1条回答
  • 2021-01-24 21:15

    To enable restore NuGet package with TFS XAML build, please try to follow below steps:

    1. In VS IDE, go to Tools -> Options -> NuGet Package Manager -> enable Allow NuGet to download missing packages.
    2. Delete NuGet.exe and NuGet.targets files from .nuget folder. Be sure these two files are deleted from version control as well.
    3. Remove the following tags from .proj file:
        1. <RestorePackages>true</RestorePackages>
    
        2.<Import Project="$(SolutionDir)\.nuget\nuget.targets" />  
    
        3. <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">  
            <PropertyGroup>
                <ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them.  For more information, 
        see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
            </PropertyGroup>
            <Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
        </Target>
    

    More details please refer this step by step tutorial:Auto restore Nuget packages with TFS Build the right way

    0 讨论(0)
提交回复
热议问题