Build error, This project references NuGet

前端 未结 7 2049
旧时难觅i
旧时难觅i 2020-12-29 18:17

When I try to build my solution, I get the following error message:

Severity Code Description Project File Line Suppression State Error

相关标签:
7条回答
  • 2020-12-29 19:15

    Quick solution that worked like a charm for me and others:

    If you are using VS 2015+, just remove the following lines from the .csproj file of your project:

      <Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
      <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>
    

    In VS 2015+ Solution Explorer:

    1. Right-click project name -> Unload Project
    2. Right-click project name -> Edit .csproj
    3. Remove the lines specified above from the file and save
    4. Right-click project name -> Reload Project
    0 讨论(0)
提交回复
热议问题