简体   繁体   中英

File not found packages.config

I have been getting this error recently on a project.

Copying file packages.config to obj\\Debug\\Package\\PackageTmp\\packages.config failed. Could not find file 'packages.config'.

I am not using NuGet at all for this project, however this error occurred after a merging of changes from the trunk to my project branch, possibly bringing in changes from VS10. I'd like to simply remove the references to this packages.config or at least put in a dummy file to make the error go away. Any suggestions would help at this point.

In your *.csproj file, try removing the line:

<None Include="packages.config" />

Remove any "Import" elements which match ".targets", and contain either "nuget" or "packages". They may be one or other dependening on NuGet version used to add packages.

Remove any "Target" elements and it's children if they contain "NuGet". Was added in a recent version to make it easier to restore missing packages.

If you are not using nuget, open your project file (*.csproj), find the line that looks like this:

<Import Project="$(SolutionDir)\.nuget\nuget.targets" />

And delete it. This should get rid of nuget references.

NB: in VS2010 this line might look different, but reference to nuget.targets should be present.

I've managed to fix it by looking at the 'source control' output (Menu->View->Output) and added the missing .nuget\\packages.config folder+file.

Than committed it to TFS.

Than, I've removed the newly created folder+file and recommitted to TFS.

HTH.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM