none
NuGet Error

    Question

  • I'm absolutely fed up with this bogus error from NuGet! I get it all the time, in all kinds of different projects.

    This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is packages\Xamarin.Forms.2.0.0.6482\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets.

    After a Google search, conventional wisdom tells me that I need to have my NuGet settings set up so that VS automatically does a restore when I build my solution. I have already done this though:

    Of course the link is just a generic pointer to no mans land at the NuGet website:

    NuGet

    I've tried removing all NuGet packages, and then adding them again, but the problem persists.

    When is Microsoft going to fix this ridiculously annoying bug? It happens with ASP MVC Projects, UWP Projects, Xamarin Projects - just about everything - all the time.

    This is what I get when I run the restore at the command prompt:

    I'm so happy for this guys who seems to think that using NuGet is a breeze!

    The Right Way to Restore NuGet Packages

    "you don’t do anything special, and it just happens!"

    NuGet once threatened to make programmers lives easier. We can all rest assured that our jobs are still just as complicated and frustrating as ever.


    Wednesday, July 27, 2016 2:37 AM

Answers

  • I have logged this bug here on GitHub:

    https://github.com/NuGet/NuGetGallery/issues/3195

    I'd appreciate it if other people would get on this repo and ask the team to get this fixed so that other people do not waste countless hours trying to chase this down.

    Tuesday, August 16, 2016 1:11 AM

All replies

  • I loaded up all my projects in Notepad and deleted this part from the csproj file:

      <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
        <PropertyGroup>
          <ErrorText>This project references NuGet package(s) that are missing on this computer. Use 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('..\packages\Xamarin.Forms.2.3.0.107\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Xamarin.Forms.2.3.0.107\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets'))" />
      </Target>

    This solved the problem. But, I have no idea what side effects this may have. Why is it here? Why does the visual studio project template add this section that breaks NuGet?

    Wednesday, July 27, 2016 5:35 AM
  • Before I mark my previous post as the answer, can anyone explain why this "Target" tag is here in the project? The VS templates for many project types add this, so there must be some reason why it is here in the first place. But, it breaks compilation.
    Thursday, July 28, 2016 12:43 AM
  • Hi MelbourneDeveloper,

    As far as I know, it was the error Condition elements for NuGet package, if we want to use Automatic Package Restore, we would remove them:

    https://docs.nuget.org/consume/package-restore/migrating-to-automatic-package-restore 

    Best Regards,

    Jack


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, July 28, 2016 9:33 AM
    Moderator
  • If that's the case, why do Visual Studio templates automatically create these elements when you create a new project? Shouldn't the teams go through all the project templates and remove these elements?
    Sunday, July 31, 2016 11:19 PM
  • Hi MelbourneDeveloper,

    >>The missing file is packages\Xamarin.Forms.2.0.0.6482\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets.

    For the package "Xamarin.Forms.2.0.0.6482", as far as I know, we install it singly like this document.

    https://www.nuget.org/packages/Xamarin.Forms/2.0.0.6482

    Do you mean that a new default project template add certain NuGet package automatically? Which kind of app did you create? Would you please share me the detailed steps? I will test it in my side.

    Best Regards,

    Jack


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, August 1, 2016 11:54 AM
    Moderator
  • Do you mean that a new default project template add certain NuGet package automatically?

    Yes. But, also, it adds this element which causes the error:

    <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
        <PropertyGroup>
          <ErrorText>This project references NuGet package(s) that are missing on this computer. Use 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('..\packages\Xamarin.Forms.2.3.0.107\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Xamarin.Forms.2.3.0.107\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets'))" />
      </Target>

    Which kind of app did you create?

    It was a Xamarin Forms Cross platform app, but this happens in many different project types.

    Tuesday, August 2, 2016 11:36 PM
  • Hi MelbourneDeveloper,

    Thanks for your friendly response.

    I could repro this issue in my side, I got the same error messages in the .xxproj file if I create the Xamarin Forms cross platform app as yours.

    It seems that it would be a feedback for the xamarin which has been submitted before:

    https://forums.xamarin.com/discussion/20732/missing-package-error

    Best Regards,

    Jack


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, August 3, 2016 11:53 AM
    Moderator
  • Hallelujah!

    Could you please contact someone at Microsoft and make sure they fix it? They won't listen to outsiders.

    Honestly, reporting bugs to Microsoft is a total waste of time. The other day I reported a bug with a sample solution on Microsoft Connect. They promptly responded by telling me to include a screenshot. I don't know why they need a screen shot when I gave them the sample app, but anyway, I tried to upload a screenshot twice, but the the file never got attached.

    Thursday, August 4, 2016 6:07 AM
  • Hi MelbourneDeveloper,

    Thanks for your feedback, but sorry for that I couldn't provide other support suggestion except the MSDN form support.

    If you require a more in-depth level of support. I suggest you visit the following link to see the various paid support options that are available to better meet your needs.http://support.microsoft.com/default.aspx?id=fh;en-us;offerprophone

    Of course, I will help you report this issue to the connect report site, if I get any latest information, I will share it here.

    Best Regards,

    Jack


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Saturday, August 6, 2016 9:18 AM
    Moderator
  • There is a bug in visual Studio or some related component. Surely, there is somewhere I can report this!

    Please research where I can report this so that someone at Microsoft knows about this and can fix it. I'm tired of reporting these problems on the forum only to hear others complaining about the same problem, and nobody at Microsoft realizing that there is even a problem.


    Sunday, August 7, 2016 11:40 PM
  • Hi MelbourneDeveloper,

    I have reported this issue, I will follow up this connect report, if I get any latest information, I will share it here.

    The report link:

    https://connect.microsoft.com/VisualStudio/feedbackdetail/view/3025900/nuget-error-in-xamarin-forms-cross-platform-app

    You could vote it.

    Best Regards,

    Jack


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, August 8, 2016 11:12 AM
    Moderator
  • Thanks. I doubt they will look at it.

    I logged something weeks ago and nobody has bothered to look at it.

    I'd appreciate it if others would vote this up.

    Monday, August 8, 2016 11:07 PM
  • Hi MelbourneDeveloper,

    Today the report team experts have discussed this issue with me about how to repro this issue, they will share the comments in that report if they get any latest information. I will help you follow up it, appreciate your patience.

    Sincerely,

    Jack


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, August 9, 2016 9:32 AM
    Moderator
  • Thanks.

    I don't expect Microsoft to fix all the problems that are reported on this forum.

    I just expect there to be a clear method for us to report problems to Microsoft, and ensure that developers are exposed to these issues so they know the problems that we face. Microsoft Connect does not seem to be fulfilling this role at the moment. I don't know if Microsoft needs to fix the Microsoft Connect system, or if they just need to make it clearer as to which GitHub repos etc. we need to need to be posting our issues on.

    We just need clarity.

    Wednesday, August 10, 2016 12:03 AM
  • I, too, have seen this "nuget" problem, all too often. It usually occurs when I make a copy of the project to another location on disk, or grab source code from github. Invariably, I need to hand edit each and every .csproj file, looking for every import, changing or nuking and re-adding the dependency. It's very time consuming, sometimes taking upwards of a day.
    Monday, August 15, 2016 1:23 PM
  • I have logged this bug here on GitHub:

    https://github.com/NuGet/NuGetGallery/issues/3195

    I'd appreciate it if other people would get on this repo and ask the team to get this fixed so that other people do not waste countless hours trying to chase this down.

    Tuesday, August 16, 2016 1:11 AM
  • The good news Ken is that it's easy to fix. You just have to delete the element from the csproj file.
    Tuesday, August 16, 2016 1:14 AM