Xamarin.Forms - 'Foundation' could not be

2019-08-07 05:19发布

I've created a new 'Blank Xaml App (Xamarin.Forms Shared)' app in Microsoft Visual Studio Enterprise 2015 version 14.0.25123.00 Update 2.

Immediately after creating the project, I was greeted with 217 errors. Restarting Visual Studio removed most of those, but 35 still remain.

The first two errors are about Foundation and UIKit not being found. I believe these two might also cause the rest of the errors.

Does anyone have some ideas as to how to solve these?

Error CS0246 The type or namespace name 'Foundation' could not be found (are you missing a using directive or an assembly reference?)
Error CS0246 The type or namespace name 'UIKit' could not be found (are you missing a using directive or an assembly reference?)

1条回答
何必那么认真
2楼-- · 2019-08-07 05:36

If you are missing the reference to Xamarin.iOS, try re-adding it manually:

Under the Xamarin.iOS project, right click References > Add Reference...

In the references dialog, on the left hand side, click on Assemblies, then Framework. Search for Xamarin.iOS and select it to add the reference.

If the Xamarin.iOS assembly isn't listed, take a look under this path:

C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\Xamarin.iOS\v1.0

If the assembly is missing from that directory, try repairing the Xamarin installation - Windows Programs and Features > Xamarin > Repair.

查看更多
登录 后发表回答