找不到Windows运行时类型' Windows.Devices.SmartCards.SmartCardReader'

时间:2016-07-22 20:04:45

标签: c# windows-7 windows-8.1 smartcard

我正在尝试构建面向Windows 7用户的Windows窗体应用程序。 我的项目使用Windows Smart Card API,需要Windows SDK 8.1。官方安装网站说:

  

您可以使用Windows SDK以及您选择的开发   环境,为Windows编写Windows应用商店应用和桌面应用   8.1以及Windows 8,Windows 7,Windows Vista,Windows Server 2012,Windows Server 2008 R2和Windows Server 2008

我安装了适用于Windows 8.1的Windows SDK并且已成功编译我的代码:

public class WindowsSmartcardManager : ISmartcardManager
{
    private readonly IDictionary<string, SmartCardReader> readers;
    private bool paused;

    private int remainingDevicesToBeIdentified = -1;

    public WindowsSmartcardManager()
    {
        readers = new Dictionary<string, SmartCardReader>();

        // First we get the device selector for smart card readers using
        // the static GetDeviceSelector method of the SmartCardReader
        // class.  The selector is a string which describes a class of
        // devices to query for, and is used as the argument to
        // DeviceInformation.FindAllAsync.  GetDeviceSelector is
        // overloaded so that you can provide a SmartCardReaderKind
        // to specify if you are only interested in a particular type
        // of card/reader (e.g. TPM virtual smart card.)  In this case
        // we will list all cards and readers.
        string selector = SmartCardReader.GetDeviceSelector();
        var findAllAsync = DeviceInformation.FindAllAsync(selector);
        findAllAsync.Completed += FindAllReadersCompleted;
    }
...

但是,当我尝试为WindowsSmartCardManager类运行单元测试时,我遇到以下错误:

error

内部异常说&#34;此平台不支持操作&#34;: inner exception

我在Windows 7,64位Service Pack 1上使用Visual Studio Professional 2015 Update 3.

如何在Windows 7上使用Windows智能卡API?

0 个答案:

没有答案