C# 基于平台类型的建筑项目

C# 基于平台类型的建筑项目,c#,.net,windows-runtime,csproj,C#,.net,Windows Runtime,Csproj,我的项目可以为x64、x86和ARM(WinRT)构建,引用特定于平台的库(也构建在x64、x86和ARM上)。 为了有条件地构建特定于平台的DLL,我手动编辑了.csproj文件,使这些特定于平台的DLL的元素如下所示: <ItemGroup Condition="'$(Platform)' == 'x86'"> <Reference Include="PortablePlatform"> <HintPath>..\..\packa

我的项目可以为x64、x86和ARM(WinRT)构建,引用特定于平台的库(也构建在x64、x86和ARM上)。 为了有条件地构建特定于平台的DLL,我手动编辑了.csproj文件,使这些特定于平台的DLL的元素如下所示:

  <ItemGroup Condition="'$(Platform)' == 'x86'">
     <Reference Include="PortablePlatform">
      <HintPath>..\..\packages\LibraryName\x86\PortablePlatform.dll</HintPath>
      <Private>True</Private>
     </Reference>
  </ItemGroup>
  <ItemGroup Condition="'$(Platform)' == 'x64'">
    <Reference Include="PortablePlatform">
      <HintPath>..\..\packages\LibraryName\x64\PortablePlatform.dll</HintPath>
      <Private>False</Private>
    </Reference>
  </ItemGroup>
  <ItemGroup Condition="'$(Platform)' == 'ARM'">
    <Reference Include="PortablePlatform">
      <HintPath>..\..\packages\LibraryName\ARM\PortablePlatform.dll</HintPath>
      <Private>False</Private>
    </Reference>
  </ItemGroup>

..\..\packages\LibraryName\x86\PortablePlatform.dll
真的
..\..\packages\LibraryName\x64\PortablePlatform.dll
假的
..\..\packages\LibraryName\ARM\PortablePlatform.dll
假的
现在,我可以编译我的解决方案了。但是,在运行时,它在加载特定于平台的dll(PortablePlatform.dll)时出错,并且该错误在xamlTypeInfo.g.cs中GetXamlType的返回语句中抛出:

public global::Windows.UI.Xaml.Markup.IXamlType GetXamlType(global::System.Type type)
        {
            if(_provider == null)
            {
                _provider = new global::<ABC>_App_XamlTypeInfo.XamlTypeInfoProvider();
            }
            return _provider.GetXamlTypeByType(type);
        }
public global::Windows.UI.Xaml.Markup.IXamlType GetXamlType(global::System.Type)
{
if(_provider==null)
{
_provider=新全局::_App_XamlTypeInfo.XamlTypeInfoProvider();
}
返回_provider.GetXamlTypeByType(类型);
}
下面是错误堆栈: .WinRT.App.exe中发生“System.IO.FileNotFoundException”类型的异常,但未在用户代码中处理
其他信息:无法加载文件或程序集“PortablePlatform,版本=0.1.0.0,区域性=中立,PublicKeyToken=null”或其依赖项之一。系统找不到指定的文件。

我能够找出问题所在。我必须从csproj文件中的
元素中删除
True/False
。不太确定,但我认为这是导致以前构建的dll在运行时加载的原因