我想使用Windows 10 IoT Core从我的Raspberry Pi 2上的U盘访问文件(图像,文本文件等)。在Windows IoT核心应用程序中访问USB存储棒文件时访问被拒绝错误
所以我已经添加到appxmanifest文件。
当使用我的IBackgroundTask这个代码,我得到第二行的access denied
错误:
public sealed class StartupTask : IBackgroundTask
{
public async void Run(IBackgroundTaskInstance taskInstance)
{
//...
Windows.Storage.StorageFolder sf = Windows.Storage.KnownFolders.RemovableDevices;
//get list of drives
IReadOnlyList<Windows.Storage.StorageFolder> list = await sf.GetFoldersAsync();
...
}
}
我发现,我应该与文件类型添加fileTypeAssociation我想Package.appxmanifest访问所以我做的是:
<?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" xmlns:iot="http://schemas.microsoft.com/appx/manifest/iot/windows10" IgnorableNamespaces="uap mp iot">
<Identity Name="test-uwp" Publisher="CN=user" Version="1.0.0.0" />
<mp:PhoneIdentity PhoneProductId="8f31dff8-3a2b-4df1-90bb-2c5267f32980" PhonePublisherId="00000000-0000-0000-0000-000000000000" />
<Properties>
<DisplayName>test</DisplayName>
<PublisherDisplayName>user</PublisherDisplayName>
<Logo>Assets\StoreLogo.png</Logo>
</Properties>
<Dependencies>
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.0.0" MaxVersionTested="10.0.0.0" />
</Dependencies>
<Resources>
<Resource Language="x-generate" />
</Resources>
<Applications>
<Application Id="App">
<uap:VisualElements DisplayName="test" Square150x150Logo="Assets\Square150x150Logo.png" Square44x44Logo="Assets\Square44x44Logo.png" Description="test" BackgroundColor="transparent" AppListEntry="none">
<uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png">
</uap:DefaultTile>
<uap:SplashScreen Image="Assets\SplashScreen.png" />
</uap:VisualElements>
<Extensions>
<Extension Category="windows.backgroundTasks" EntryPoint="test.StartupTask">
<BackgroundTasks>
<iot:Task Type="startup" />
</BackgroundTasks>
</Extension>
<uap:Extension Category="windows.fileTypeAssociation">
<uap:FileTypeAssociation Name="myimages">
<uap:SupportedFileTypes>
<uap:FileType ContentType="image/jpeg">.jpg</uap:FileType>
</uap:SupportedFileTypes>
</uap:FileTypeAssociation>
</uap:Extension>
</Extensions>
</Application>
</Applications>
<Capabilities>
<Capability Name="internetClient" />
<uap:Capability Name="removableStorage" />
</Capabilities>
</Package>
如果我想部署,我收到以下错误:
Severity Code Description Project File Line Suppression State Error Error : DEP0700 : Registration of the app failed. AppxManifest.xml(37,10): error 0x80070490: Cannot register the test-uwp_1.0.0.0_arm__yzekw4x8qxe1g package because the following error was encountered while parsing the windows.fileTypeAssociation Extension element: Element not found. . Try again and contact the package publisher if the problem persists. (0x80073cf6)
只要我删除uap:Extension元素,错误消失(但拒绝访问仍然存在)。
我错过了什么?是否无法使用后台服务从USB存储器访问文件(我想在没有用户交互的情况下运行该无人机)?
这里对我来说同样的问题。找不到任何信息,为什么这不起作用。清单编辑器让我添加关联,但... – ManniAT