gpt4 book ai didi

xamarin.forms - Xamarin Forms共享项目新内容页面cs文件未耦合

转载 作者:行者123 更新时间:2023-12-05 07:39:56 25 4
gpt4 key购买 nike

Visual Studio 2017 专业版。

Xamarin 跨平台应用、空白应用、Xamarin.Forms、共享项目。

在共享项目中,如果我添加新的 Xamarin.Forms 内容页面 (Page1),.xaml 和 xaml.cs 文件不会像您预期的那样耦合。

enter image description here

我通过手动编辑 .projitems 文件找到了解决方法(将 SubType 标记替换为 DependentUpon 标记):

>     <Compile Include="$(MSBuildThisFileDirectory)MainPage.xaml.cs">
<DependentUpon>MainPage.xaml</DependentUpon>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)Page1.xaml.cs">
<SubType>Code</SubType>
</Compile>

这似乎是一个错误?无论如何不必进行此手动编辑以获得所需的结果?

最佳答案

我不确定这里有什么问题。正如您所指出的,您可以选择编辑项目文件。

另一种不需要您手动编辑项目文件的解决方案是:

  1. 从项目中排除 .xaml.xaml.cs(右键单击文件 => 从项目中排除)
  2. 选择添加现有项目(右键单击项目 => 添加现有项目)
  3. 仅选择 .xaml 文件

Visual Studio 现在应该导入这两个文件并“耦合”它们。

关于xamarin.forms - Xamarin Forms共享项目新内容页面cs文件未耦合,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46693461/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com