我想使用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