If you are using TFS
Remove the NuGet.exe
and NuGet.targets
files from the solution's .nuget
folder. Make sure the files themselves are also removed from the solution workspace.
Retain the NuGet.Config
file to continue to bypass adding packages to source control.
Edit each project file (e.g., .csproj, .vbproj) in the solution and remove any references to the NuGet.targets
file. Open the project file(s) in the editor of your choice and remove the following settings:
<RestorePackages>true</RestorePackages>
...
<Import Project="$(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>
If you are not using TFS
Remove the .nuget
folder from your solution. Make sure the folder itself is also removed from the solution workspace.
Edit each project file (e.g., .csproj, .vbproj) in the solution and remove any references to the NuGet.targets
file. Open the project file(s) in the editor of your choice and remove the following settings:
<RestorePackages>true</RestorePackages>
...
<Import Project="$(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>
Reference: Migrating MSBuild-Integrated solutions to use Automatic Package Restore