Cannot add Linq2Twitter package to Xamarin Studio

2019-07-03 23:33发布

问题:

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 :-)

回答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



回答2:

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.