【发布时间】:2016-05-27 07:29:58
【问题描述】:
我有一个 c++ WinRT 组件,已添加到我的控制台应用程序参考中。它编译没有任何错误,但是在运行应用程序时出现以下错误
“System.TypeLoadException”类型的未处理异常发生在 mscorlib.dll
附加信息:找不到 Windows 运行时类型 'ProcessorInfoComponent.ProcessorInfoProvider'。 my error
这是我的代码:
.h 文件:
#pragma once
namespace ProcessorInfoComponent
{
public ref class ProcessorInfoProvider sealed
{
public:
bool IsNeonSupported();
};
}
.cpp 文件:
#include "pch.h"
#include "ProcessorInfoComponent.h"
using namespace ProcessorInfoComponent;
bool ProcessorInfoProvider::IsNeonSupported()
{
return IsProcessorFeaturePresent(PF_ARM_VFP_32_REGISTERS_AVAILABLE);
}
在c#中使用的是: .cs
static void Main(string[] args)
{
var processorInfoProvider = new ProcessorInfoComponent.ProcessorInfoProvider();
var isNeonSupported = processorInfoProvider.IsNeonSupported();
Console.WriteLine(isNeonSupported);
}
此 WinRT 在 windows phone 和 WPF APP 中运行良好,但在 windows 窗体和控制台应用程序中无法运行。 谢谢。
【问题讨论】:
标签: c# windows-runtime console