Windows runtime Windows应用程序认证工具包失败,错误为:找不到类型System.type-元数据文件中引用的所有类型都必须是可发现的

Windows runtime Windows应用程序认证工具包失败,错误为:找不到类型System.type-元数据文件中引用的所有类型都必须是可发现的,windows-runtime,c++-cx,app-certification-kit,wack,Windows Runtime,C++ Cx,App Certification Kit,Wack,我无法通过应用程序认证工具包,因为当它运行Windows运行时元数据验证测试时,它会创建一组错误消息,所有这些消息都抱怨类型系统。类型: > The type System.Type referenced by type > ShapefileUniversal.__IFieldInfoPublicNonVirtuals in file C:\Program > Files\windowsapps\5b38d4f4.capturestreetsvirb360_1.0.0

我无法通过应用程序认证工具包,因为当它运行Windows运行时元数据验证测试时,它会创建一组错误消息,所有这些消息都抱怨类型系统。类型

> The type System.Type referenced by type
> ShapefileUniversal.__IFieldInfoPublicNonVirtuals in file C:\Program
>     Files\windowsapps\5b38d4f4.capturestreetsvirb360_1.0.0.0_x86__64b1t2me17ncm\ShapefileUniversal.winmd
> was not found. All types referenced in metadata files must be
> discoverable. The type System.Type referenced by type
> ShapefileUniversal.__IFieldInfoPublicNonVirtuals in file C:\Program
> Files\windowsapps\5b38d4f4.capturestreetsvirb360_1.0.0.0_x86__64b1t2me17ncm\ShapefileUniversal.winmd
> was not found. All types referenced in metadata files must be
> discoverable. The type System.Type referenced by type
> ShapefileUniversal.FieldInfo in file C:\Program
> Files\windowsapps\5b38d4f4.capturestreetsvirb360_1.0.0.0_x86__64b1t2me17ncm\ShapefileUniversal.winmd
> was not found. All types referenced in metadata files must be
> discoverable. The type System.Type referenced by type
> ShapefileUniversal.FieldInfo in file C:\Program
> Files\windowsapps\5b38d4f4.capturestreetsvirb360_1.0.0.0_x86__64b1t2me17ncm\ShapefileUniversal.winmd
> was not found. All types referenced in metadata files must be
> discoverable.
.assembly extern mscorlib
{
  .publickeytoken = (B7 7A 5C 56 19 34 E0 89 )                         // .z\V.4..
  .ver 255:255:255:255
}
.assembly windowsruntime ShapefileUniversal
{
  .hash algorithm 0x00008004
  .ver 255:255:255:255
}
.module ShapefileUniversal.winmd
// MVID: {F9F10CFE-F163-4405-8B7F-AEFF3EE1DD60}
.imagebase 0x10000000
.file alignment 0x00000200
.stackreserve 0x00100000
.subsystem 0x0003       // WINDOWS_CUI
.corflags 0x00000001    //  ILONLY
// Image base: 0x07430000
ShapefileUniversal是一个用C++/CX开发的Windows运行时组件,其类型FieldInfo编码如下:

public ref class FieldInfo sealed
{
public:
    property Platform::String^ Name;
    property Platform::Type^ Type;
    property uint8 Size;
};
它引用了Platform::Type,但通过使用dotPeek或ILDasm分析.winmd文件,我意识到它实际上被转换为[mscorlib]System.Type,正如您在ILDasm输出的下一个片段中所看到的:

.property instance class [mscorlib]System.Type
        Type()
{
  .set instance void ShapefileUniversal.FieldInfo::set_Type(class [mscorlib]System.Type)
  .get instance class [mscorlib]System.Type ShapefileUniversal.FieldInfo::get_Type()
} // end of property FieldInfo::Type
分析清单时,组件引用了mscorlib

> The type System.Type referenced by type
> ShapefileUniversal.__IFieldInfoPublicNonVirtuals in file C:\Program
>     Files\windowsapps\5b38d4f4.capturestreetsvirb360_1.0.0.0_x86__64b1t2me17ncm\ShapefileUniversal.winmd
> was not found. All types referenced in metadata files must be
> discoverable. The type System.Type referenced by type
> ShapefileUniversal.__IFieldInfoPublicNonVirtuals in file C:\Program
> Files\windowsapps\5b38d4f4.capturestreetsvirb360_1.0.0.0_x86__64b1t2me17ncm\ShapefileUniversal.winmd
> was not found. All types referenced in metadata files must be
> discoverable. The type System.Type referenced by type
> ShapefileUniversal.FieldInfo in file C:\Program
> Files\windowsapps\5b38d4f4.capturestreetsvirb360_1.0.0.0_x86__64b1t2me17ncm\ShapefileUniversal.winmd
> was not found. All types referenced in metadata files must be
> discoverable. The type System.Type referenced by type
> ShapefileUniversal.FieldInfo in file C:\Program
> Files\windowsapps\5b38d4f4.capturestreetsvirb360_1.0.0.0_x86__64b1t2me17ncm\ShapefileUniversal.winmd
> was not found. All types referenced in metadata files must be
> discoverable.
.assembly extern mscorlib
{
  .publickeytoken = (B7 7A 5C 56 19 34 E0 89 )                         // .z\V.4..
  .ver 255:255:255:255
}
.assembly windowsruntime ShapefileUniversal
{
  .hash algorithm 0x00008004
  .ver 255:255:255:255
}
.module ShapefileUniversal.winmd
// MVID: {F9F10CFE-F163-4405-8B7F-AEFF3EE1DD60}
.imagebase 0x10000000
.file alignment 0x00000200
.stackreserve 0x00100000
.subsystem 0x0003       // WINDOWS_CUI
.corflags 0x00000001    //  ILONLY
// Image base: 0x07430000
所以我想一切都会好起来的。我不明白为什么ACK找不到WRC中使用的System.Type

编译器(Visual Studio 2017更新为15.6.6),NuGet软件包全部更新,在C++/CX项目中,目标平台版本和目标平台最低版本均为10.0.16299.0,并且应用程序在debug、release、win32、x64中正确运行,问题仅在于WACK


提前感谢。

您需要使用类型
Windows::UI::Xaml::Interop::TypeName

TypeName
是与语言无关的Windows运行时结构 表示类型信息<代码>平台::类型是C++专用的 无法通过应用程序二进制接口(ABI)传递

<>我很惊讶C++编译器没有抱怨在公共接口中使用那种类型;看起来像个虫子