VS 15.3 标准库未连接 xaml 和 xaml.cs

VS 15.3 Standard Library not connecting xaml and xaml.cs

昨天更新了VS(15.3)、.NET Standard 2.0、.NET Core SDK 2.0等。在那之后,我当前的 Xamarin Forms 项目失败了。大多数包都失去了兼容性(尽管我没有更改库的 standard1.4 版本)。因此,我通过 VS 创建了一个新的 standard1.4 库(如此处所述:https://xamarinhelp.com/visual-studio-2017-net-standard-xamarin/)。我将代码从旧 Xamarin 库复制到新库并添加了所有包。

现在的问题是所有 xaml 和 xaml.cs 都被拆分了,我得到了编译错误。我无法像以前那样连接文件 (How can I connect xaml and xaml.cs files),因为随着 netstandard 的发展,csproj 已经完全改变了。更令人惊讶的是,即使我向项目添加新的 xaml 页面,xaml 和 xaml.cs 文件也会被拆分。我该如何解决这个问题?

通过我在 Microsoft Developer Network (https://developercommunity.visualstudio.com/content/problem/96027/vs-153-netstandard-xaml-and-xamlcs-seperated-and-c.html) 上的 post 找到了解决方案

感谢 Long Nguyen(查看来源):
按照这篇文章修复它: https://oren.codes/2017/04/23/using-xamarin-forms-with-net-standard-vs-2017-edition/

在 .csproj 文件中,您可以看到他声明了 .xaml 页面:

<ItemGroup>
  <!-- <a href="https://bugzilla.xamarin.com/show_bug.cgi?id=55591">https://bugzilla.xamarin.com/show_bug.cgi?id=55591</a> -->
  <None Remove="***.xaml" />
  <Compile Update="***.xaml.cs" DependentUpon="%(Filename)" />
  <EmbeddedResource Include="***.xaml" SubType="Designer" Generator="MSBuild:UpdateDesignTimeXaml" />
</ItemGroup>

对 csproj 进行更改后,它应该会再次获取 xaml 和 xaml.cs 文件。