2
votes

I'm getting the following error while move the Xamarin Form project.

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 ....\packages\Xamarin.Forms.1.0.6186\build\portable-win+net45+wp80+MonoAndroid10+MonoTouch10\Xamarin.Forms.targets.

I can't find any solution to resolve this.

3

3 Answers

1
votes

There might be also a problem with leftover directives in .csproj when you upgraded Xamarin.Forms. So, check what XF version are you using and remove all the lines in .csproj where directives are referencing wrong version. They are usually located at the bottom of the file.

1
votes

The most common cause and resolution of this error message is documented in the following troubleshooting article: https://developer.xamarin.com/guides/cross-platform/troubleshooting/questions/nuget-packages-missing/

Essentially, certain configurations of NuGet hard code the package imports into the .csproj file itself. The most frequent time I've seen this behavior is when a Xamarin.Forms app is created in Visual Studio and migrated over to Xamarin Studio; however it can happen in other cases.

The offending lines in the .csproj file look something like this:

<Reference Include="Xamarin.Forms.Maps">
    <HintPath>..\..\packages\Xamarin.Forms.Maps.1.3.1.6296\lib\portable-win+net45+wp80+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.Maps.dll</HintPath>
</Reference>

<Import Project="..\..\packages\Xamarin.Forms.1.3.1.6296\build\portable-win+net45+wp80+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets" Condition="Exists('..\..\packages\Xamarin.Forms.1.3.1.6296\build\portable-win+net45+wp80+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets')" />
<Error Condition="!Exists('..\..\packages\Xamarin.Forms.1.3.1.6296\build\portable-win+net45+wp80+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Xamarin.Forms.1.3.1.6296\build\portable-win+net45+wp80+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets'))" />

Deleting these lines (or commenting them out) generally resolves the issue.

0
votes

The above mentioned issue was resolved by move the package folder to the root folder.

Is there any way to change the package folder path?