在 Visual Studio 2017 预览版 15.6.0 v1.1 中创建每个跨平台项目后,我收到图片中的错误,实际上是 2 个错误。
The name 'InitializeComponent' does not exist in the current context
第二个错误与 NuGet 包管理器有关,我无法更新任何包,错误消息:
Package restore failed. Rolling back package changes for 'testApplication.Android'.
最佳答案
如果没有一些实际的代码错误,我会尝试以下操作
关于
The name 'InitializeComponent' does not exist in the current context
对我有用的步骤
- 清洁解决方案
- 删除所有项目中的 bin 和 objs 方向
- 重启 Visual Studio
- 重建
关于
Package restore failed
尝试在包包控制台中更新解决方案的所有包
Update-Package –reinstall
关于您在尝试 Update-Package -reinstall
时的评论
Update-Package : Package Xamarin.Android.Support.Design 26.1.0.1 is not compatible with monoandroid71 (MonoAndroid,Version=v7.1). Package Xamarin.Android.Support.Design 26.1.0.1 supports: monoandroid80 (MonoAndroid,Version=v8.0)
同时检查您是否使用了适当版本的 Andriod Sdk
Tools > Andriod > Andriod Sdk Manager
关于c# - Xamarin.窗体 : "InitializeComponent" and "Package restore failed" Build Errors,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48187142/