Xamarin Studio for Mac 不生成 *.xaml.g.cs for .NET Standard Xamarin Forms iOS 应用程序

Xamarin Studio for Mac not generating *.xaml.g.cs for .NET Standard Xamarin Forms iOS app

我目前正在 .NET Standard v1.3 之上构建 Xamarin Forms iOS 应用程序。当我在 Mac 上使用 Xamarin Studio 时,我 运行 遇到了应用程序编译问题,但它在 Windows 上的 Visual Studio 和单独的机器上工作正常运行 Mac 的新 Visual Studio 预览。

在 Mac 的 Xamarin Studio 中,我在编译应用程序时遇到此错误:

App.xaml.cs(25,13): error CS0103: The name `InitializeComponent' does not exist in the current context
Base/BaseView.xaml.cs(11,13): error CS0103: The name `InitializeComponent' does not exist in the current context
View/LoginView.xaml.cs(9,13): error CS0103: The name `InitializeComponent' does not exist in the current context

解决方案中的每个 XAML 文件都会发生这种情况。我明白为什么 - *.xaml.g.cs 文件没有生成。在 Windows 的 Visual Studio 和 Mac 的 Visual Studio 预览中,它们被放入项目的 obj/Release 文件夹中 - 但在 Xamarin Studio 中 Mac,它们根本没有生成。

我有另一个 Xamarin Forms 应用程序,它使用完整的 .NET Framework 而不是 .NET Standard。此应用程序在 Xamarin Studio 上编译良好 Mac。这让我相信问题可能与 .NET Standard 相关。

主要 Mac 我是 运行 Xamarin Studio (6.1.5) 和 Mono 4.6.2,Xamarin.Android 7.0.2.42,Xamarin.iOS 10.3.1.8 .在 Windows 我是 运行 Visual Studio 2015 更新 3 (14.0.25341),使用 Xamarin 4.2.2.11、Xamarin.Android 7.0.2.42 和 Xamarin.iOS 10.3。 1.8.在第二个 Mac 我是 运行 Visual Studio for Mac Preview 3 (7.0 build 1077) with Xamarin iOS 10.4.0.88.

我不知道它是否有帮助,但在 Visual Studio for Windows 我也在每个 XAML 文件中得到这个错误(但项目仍然编译正常) :

Build action 'EmbeddedResource' is not supported by one or more of the project's targets.

在 Xamarin Studio 上 Mac 是否有任何原因无法生成 *.xaml.g.cs 文件 - 可能与使用 .NET Standard 有关?

如果我需要为 Mac 切换到 Visual Studio 预览版,我会考虑,但我宁愿不依赖预发布工具进行生产项目。

如果您的解决方案中包含任何 .net Standard 项目,您必须使用 Xamarin Studio 6.2 或更高版本,否则它将失败,以前的版本只允许使用 .net Standard 库,不允许编译此类项目。