Msbuild 更改BaseMediateOutputPath会导致生成错误CS0103

Msbuild 更改BaseMediateOutputPath会导致生成错误CS0103,msbuild,xamarin.forms,Msbuild,Xamarin.forms,我有一个简单的.net标准项目,其中包括VisualStudio2017中的Xamarin.Forms。在我更改项目文件中的默认BaseMediateOutputPath之前,构建是成功的 .csproj文件的片段: <PropertyGroup> <TargetFramework>netstandard1.4</TargetFramework> <PackageTargetFallback>portable-net45+win8+

我有一个简单的.net标准项目,其中包括VisualStudio2017中的Xamarin.Forms。在我更改项目文件中的默认BaseMediateOutputPath之前,构建是成功的

.csproj文件的片段:

<PropertyGroup>
    <TargetFramework>netstandard1.4</TargetFramework>
    <PackageTargetFallback>portable-net45+win8+wpa81+wp8</PackageTargetFallback>
    <BaseIntermediateOutputPath>hello/</BaseIntermediateOutputPath>   <!-- Comment this out and build passes -->
</PropertyGroup>

netstandard1.4
portable-net45+win8+wpa81+wp8
你好/
生成错误为:

Page1.xaml.cs(17,4):错误CS0103:名称“InitializeComponent”在当前上下文中不存在

检查msbuild输出后。看起来XamlG目标从未包含/执行过

有什么见解吗

谢谢


C.

如果异常“InitializeComponent”遇到BaseMediateOutput路径问题,则它没有意义。这个小小的异常片段将您指向问题背后的类(Page1.Xaml.cs)。我要再次检查xamarin是否在“Page1”的构造函数中指定了“Initialize”方法的属性。很奇怪,删除xaml中的这一行允许您的应用程序生成。将BaseMediateOutputPath更改为obj/以外的其他内容会导致xamarin.forms.target不生成.xaml文件(根本原因)。InitializeComponents()方法是通过构建.xaml文件生成的,该文件在中间输出路径中创建.xaml.g.cs,并包含在编译中。.xaml.g.cs(分部)类是包含Initializecomponents()方法的类。