3

When trying to add the Linq2Twitter NuGet package to Xamarin Studio, I get the following error:

Could not find a part of the path "(..)/packages/linqtotwitter.3.1.1/linqtotwitter.3.1.1.nupkg".

Previously the package was installed but could not be reference from my code. After a bit of research I found that is may has something to do with missing support for PCL's (http://lastexitcode.com/blog/2014/11/16/InstallingPortableClassLibrariesForXamarinStudio/)

After installing the mono MDK (Mono Development Kit) here http://www.mono-project.com/download/, I was no longer able to add the package to my project.

Any ideas :-)

Corstiaan
  • 1,114
  • 15
  • 34

2 Answers2

1

Had the same issue multiple times, only in Xamarin Studio on Mac. Issue was fixed by manually editing the packages.config to have the id in lowercase instead of the one provided by NuGet, both in PCL and iOS project..

The entry with based on id would then be:

<package id="linqtotwitter" version="(...)" targetFramework="(...)" />

More info in the discussion with the other answer in this topic of @MattWard

Hutjepower
  • 1,241
  • 12
  • 17
0

There are some case sensitivity problems with NuGet when you are not on Windows. If the package id and the package filename do not have the same case then you can see some errors. It does not look like a Portable Class Library (PCL) profile problem.

linqtotwitter has a problem with its package id and file name since the package Id does not match the case of the filename which looks like the problem you are seeing. I am assuming that the file exists but has a different case:

/packages/linqtotwitter.3.1.1/linqtotwitter.3.1.1.nupkg

You may be able to workaround this by changing the .nupkg so it has the same filename case as the package id which is all lower case.

However I can add linqtotwitter to a Portable Class Library project using Xamarin Studio on the Mac without any errors. Are you using Linux? Using MonoDevelop on Linux has more case sensitivity problems compared with using it on the Mac.

Matt Ward
  • 47,057
  • 5
  • 93
  • 94
  • The nuspec id is LinqToTwitter and the assembly name is LinqToTwitterPcl.dll. The project name itself is in lower case. What do you think is the best fix? – Joe Mayo Dec 16 '14 at 19:50
  • I am on Mac as well. No luck with Matts suggestion I am afraid... Project was previously a visual studio project, if that is of any concern. Just started a blank project to test, same result... – Corstiaan Dec 16 '14 at 20:36
  • @JoeMayo - Ideally NuGet would be fixed so it just works. Currently the package id is lowercase on nuget.org. On the Mac the only problem this causes is that in Xamarin Studio it looks like the package is not restored as in this bug report - https://bugzilla.xamarin.com/show_bug.cgi?id=21531 – Matt Ward Dec 16 '14 at 21:13
  • @Corstiaan - Try removing the linqtotwitter files from the packages directory if they exist. Then reinstalling the NuGet package. With a new PCL project then adding linqtotwitter NuGet package to it works for me on the Mac. Does that work for you? – Matt Ward Dec 16 '14 at 21:17
  • @Corstiaan - Are you using a hard disk on the Mac that has a case sensitive file system configured? – Matt Ward Dec 16 '14 at 21:32
  • @Matt. No... Also, I actually want to add it to a console app project . Is that the issue? – Corstiaan Dec 17 '14 at 07:00
  • @Corstiaan - No I can add it to a console app project without any errors. I would try a new console app project and see if that works. If not then it may help if I can see the full Package Console output and the IDE log (Help - Open Log Directory). If there is an exception the IDE log should have the full callstack. Then run some simple checks such as if the file that it says does not exist actually exists. – Matt Ward Dec 17 '14 at 09:10
  • Had the same issue multiple times, only in Xamarin Studio on Mac. Issue was fixed by manually editing the packages.config to have the id in lowercase.. Trying to manually edit the nupkg as suggested in this answer was denied by the OS. Shall leave the solution in this comment as answer also... @JoeMayo: For me NuGet should fix this automatically, regardless of case sensitivity. For me it would suit my nerves the best (if possible) if everything would be in PascalCasing... – Hutjepower Apr 28 '15 at 09:12