After updating Xamarin.Forms NuGet package, “The …

2019-09-15 03:29发布

问题:

I'm working on a Xamarin.Forms project in Visual Studio 2017, and just updated the NuGet package from Xamarin.Forms.2.2.0.31 to Xamarin.Forms.2.3.4.247.

After doing so, when I try to run the app, I get the following error in my Visual Studio console:

The "Xamarin.Forms.Build.Tasks.FixedCreateCSharpManifestResourceName" task could not be loaded from the assembly C:\Workspaces\OmniChannel\Dev\Mobile\NativeApp\Features\F6173-I18n\packages\Xamarin.Forms.2.2.0.31\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.Build.Tasks.dll. Could not load file or assembly 'file:///C:\Workspaces\OmniChannel\Dev\Mobile\NativeApp\Features\F6173-I18n\packages\Xamarin.Forms.2.2.0.31\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.Build.Tasks.dll' or one of its dependencies. The system cannot find the file specified. Confirm that the declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. StoreFulfillment.Core

That tells me it's looking in the packages folder for the old Xamarin.form version ("packages/Xamarin.Forms.2.2.0.31").

QUESTION: What exactly is trying to use the old reference, and how do I update it?

回答1:

I think you should remove < Import Project="....\packages\ > for old Xamarin version in .csproj. Sometimes it wasn't removed when you update Nuget.