Raspberry Pi,格罗夫,Windows 物联网,C#
Raspberry Pi, Grove, Windows IoT, C#
我目前正在使用我的 Raspberry Pi Grove 传感器和 Windows IoT 进行试验。我正在尝试启动最简单的程序,但收到错误消息。
代码看起来是这样的:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Http;
using Windows.ApplicationModel.Background;
using GrovePi;
using GrovePi.I2CDevices;
using GrovePi.Sensors;
using GrovePi.Common;
// The Background Application template is documented at http://go.microsoft.com/fwlink/?LinkID=533884&clcid=0x409
namespace IoT_THS_final
{
public sealed class StartupTask : IBackgroundTask
{
IRgbLcdDisplay LCDDisplay;
public void Run(IBackgroundTaskInstance taskInstance)
{
LCDDisplay = DeviceFactory.Build.RgbLcdDisplay();
for (int i = 1; i < 1000; i++)
{
i = i + 50;
LCDDisplay.SetBacklightRgb(BitConverter.GetBytes(i)[0], BitConverter.GetBytes(i)[0], BitConverter.GetBytes(i)[0]);
LCDDisplay.SetText("Hello");
System.Threading.Tasks.Task.Delay(1000).Wait();
}
}
}
}
出现错误:
Error Validation Error. error C00CE169: App manifest validation error: The app manifest must be valid as per schema: Line 10, Column 13, Reason: 'IoT_THS_final-uwp' conflicts with pattern declaration '[-.A-Za-z0-9]+'. Analysis from attribute 'Name' with value 'IoT_THS_final-uwp' failed. IoT THS final C:\Users\k39540\Desktop\IoT THS final\IoT THS final\bin\ARM\Debug\AppxManifest.xml
并且有一个应用程序清单:
<?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 build" xmlns:build="http://schemas.microsoft.com/developer/appx/2015/build">
<!--
DIESE PAKETMANIFESTDATEI WIRD DURCH DEN BUILDVORGANG GENERIERT.
Änderungen an dieser Datei gehen verloren, wenn sie erneut erstellt wird. Um Fehler in dieser Datei zu beheben, bearbeiten Sie die ".appxmanifest"-Quelldatei.
Weitere Informationen zu Paketmanifestdateien finden Sie unter http://go.microsoft.com/fwlink/?LinkID=241727
-->
<Identity Name="IoT_THS_final-uwp" Publisher="CN=k39540" Version="1.0.0.0" ProcessorArchitecture="arm" />
<mp:PhoneIdentity PhoneProductId="f9c878e4-f444-4db2-b42a-7eccc1a5253a" PhonePublisherId="00000000-0000-0000-0000-000000000000" />
<Properties>
<DisplayName>IoT THS final</DisplayName>
<PublisherDisplayName>k39540</PublisherDisplayName>
<Logo>Assets\StoreLogo.png</Logo>
</Properties>
<Dependencies>
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.10240.0" MaxVersionTested="10.0.17134.0" />
</Dependencies>
<Resources>
<Resource Language="DE-DE" />
</Resources>
<Applications>
<Application Id="App">
<uap:VisualElements DisplayName="IoT THS final" Square150x150Logo="Assets\Square150x150Logo.png" Square44x44Logo="Assets\Square44x44Logo.png" Description="IoT THS final" BackgroundColor="transparent" AppListEntry="none">
<uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png" />
<uap:SplashScreen Image="Assets\SplashScreen.png" />
</uap:VisualElements>
<Extensions>
<Extension Category="windows.backgroundTasks" EntryPoint="IoT_THS_final.StartupTask">
<BackgroundTasks>
<iot:Task Type="startup" />
</BackgroundTasks>
</Extension>
</Extensions>
</Application>
</Applications>
<Capabilities>
<Capability Name="internetClient" />
</Capabilities>
<Extensions>
<Extension Category="windows.activatableClass.inProcessServer">
<InProcessServer>
<Path>CLRHost.dll</Path>
<ActivatableClass ActivatableClassId="IoT_THS_final.StartupTask" ThreadingModel="both" />
</InProcessServer>
</Extension>
</Extensions>
<build:Metadata>
<build:Item Name="TargetFrameworkMoniker" Value=".NETCore,Version=v5.0" />
<build:Item Name="VisualStudio" Version="15.0" />
<build:Item Name="VisualStudioEdition" Value="Microsoft Visual Studio Enterprise 2017" />
<build:Item Name="OperatingSystem" Version="10.0.17134.346 (WinBuild.160101.0800)" />
<build:Item Name="Microsoft.Build.AppxPackage.dll" Version="15.0.28010.2016" />
<build:Item Name="ProjectGUID" Value="{31B90FEB-4419-45AA-8616-D96D2F5B9713}" />
<build:Item Name="OptimizingToolset" Value="None" />
<build:Item Name="TargetRuntime" Value="Managed" />
<build:Item Name="Microsoft.Windows.UI.Xaml.Build.Tasks.dll" Version="15.0.28010.2016" />
<build:Item Name="WindowsIoT" Version="10.0.17134.0" />
<build:Item Name="MakePri.exe" Version="10.0.17134.12 (WinBuild.160101.0800)" />
</build:Metadata>
</Package>
亲切的问候,
亚历克斯
阅读错误日志时,我们可以看到以下内容:
Reason: 'IoT_THS_final-uwp' verstößt gegen pattern-Einschränkung von '[-.A-Za-z0-9]+'
这意味着 IoT_THS_final-uwp
包含不允许的字符。允许的字符为 [-.A-Za-z0-9]+
。这意味着您需要从名称中删除下划线 (_
),这应该可以解决您的问题。 (也感谢评论中的@yW0K5o)
我目前正在使用我的 Raspberry Pi Grove 传感器和 Windows IoT 进行试验。我正在尝试启动最简单的程序,但收到错误消息。
代码看起来是这样的:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Http;
using Windows.ApplicationModel.Background;
using GrovePi;
using GrovePi.I2CDevices;
using GrovePi.Sensors;
using GrovePi.Common;
// The Background Application template is documented at http://go.microsoft.com/fwlink/?LinkID=533884&clcid=0x409
namespace IoT_THS_final
{
public sealed class StartupTask : IBackgroundTask
{
IRgbLcdDisplay LCDDisplay;
public void Run(IBackgroundTaskInstance taskInstance)
{
LCDDisplay = DeviceFactory.Build.RgbLcdDisplay();
for (int i = 1; i < 1000; i++)
{
i = i + 50;
LCDDisplay.SetBacklightRgb(BitConverter.GetBytes(i)[0], BitConverter.GetBytes(i)[0], BitConverter.GetBytes(i)[0]);
LCDDisplay.SetText("Hello");
System.Threading.Tasks.Task.Delay(1000).Wait();
}
}
}
}
出现错误:
Error Validation Error. error C00CE169: App manifest validation error: The app manifest must be valid as per schema: Line 10, Column 13, Reason: 'IoT_THS_final-uwp' conflicts with pattern declaration '[-.A-Za-z0-9]+'. Analysis from attribute 'Name' with value 'IoT_THS_final-uwp' failed. IoT THS final C:\Users\k39540\Desktop\IoT THS final\IoT THS final\bin\ARM\Debug\AppxManifest.xml
并且有一个应用程序清单:
<?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 build" xmlns:build="http://schemas.microsoft.com/developer/appx/2015/build">
<!--
DIESE PAKETMANIFESTDATEI WIRD DURCH DEN BUILDVORGANG GENERIERT.
Änderungen an dieser Datei gehen verloren, wenn sie erneut erstellt wird. Um Fehler in dieser Datei zu beheben, bearbeiten Sie die ".appxmanifest"-Quelldatei.
Weitere Informationen zu Paketmanifestdateien finden Sie unter http://go.microsoft.com/fwlink/?LinkID=241727
-->
<Identity Name="IoT_THS_final-uwp" Publisher="CN=k39540" Version="1.0.0.0" ProcessorArchitecture="arm" />
<mp:PhoneIdentity PhoneProductId="f9c878e4-f444-4db2-b42a-7eccc1a5253a" PhonePublisherId="00000000-0000-0000-0000-000000000000" />
<Properties>
<DisplayName>IoT THS final</DisplayName>
<PublisherDisplayName>k39540</PublisherDisplayName>
<Logo>Assets\StoreLogo.png</Logo>
</Properties>
<Dependencies>
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.10240.0" MaxVersionTested="10.0.17134.0" />
</Dependencies>
<Resources>
<Resource Language="DE-DE" />
</Resources>
<Applications>
<Application Id="App">
<uap:VisualElements DisplayName="IoT THS final" Square150x150Logo="Assets\Square150x150Logo.png" Square44x44Logo="Assets\Square44x44Logo.png" Description="IoT THS final" BackgroundColor="transparent" AppListEntry="none">
<uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png" />
<uap:SplashScreen Image="Assets\SplashScreen.png" />
</uap:VisualElements>
<Extensions>
<Extension Category="windows.backgroundTasks" EntryPoint="IoT_THS_final.StartupTask">
<BackgroundTasks>
<iot:Task Type="startup" />
</BackgroundTasks>
</Extension>
</Extensions>
</Application>
</Applications>
<Capabilities>
<Capability Name="internetClient" />
</Capabilities>
<Extensions>
<Extension Category="windows.activatableClass.inProcessServer">
<InProcessServer>
<Path>CLRHost.dll</Path>
<ActivatableClass ActivatableClassId="IoT_THS_final.StartupTask" ThreadingModel="both" />
</InProcessServer>
</Extension>
</Extensions>
<build:Metadata>
<build:Item Name="TargetFrameworkMoniker" Value=".NETCore,Version=v5.0" />
<build:Item Name="VisualStudio" Version="15.0" />
<build:Item Name="VisualStudioEdition" Value="Microsoft Visual Studio Enterprise 2017" />
<build:Item Name="OperatingSystem" Version="10.0.17134.346 (WinBuild.160101.0800)" />
<build:Item Name="Microsoft.Build.AppxPackage.dll" Version="15.0.28010.2016" />
<build:Item Name="ProjectGUID" Value="{31B90FEB-4419-45AA-8616-D96D2F5B9713}" />
<build:Item Name="OptimizingToolset" Value="None" />
<build:Item Name="TargetRuntime" Value="Managed" />
<build:Item Name="Microsoft.Windows.UI.Xaml.Build.Tasks.dll" Version="15.0.28010.2016" />
<build:Item Name="WindowsIoT" Version="10.0.17134.0" />
<build:Item Name="MakePri.exe" Version="10.0.17134.12 (WinBuild.160101.0800)" />
</build:Metadata>
</Package>
亲切的问候,
亚历克斯
阅读错误日志时,我们可以看到以下内容:
Reason: 'IoT_THS_final-uwp' verstößt gegen pattern-Einschränkung von '[-.A-Za-z0-9]+'
这意味着 IoT_THS_final-uwp
包含不允许的字符。允许的字符为 [-.A-Za-z0-9]+
。这意味着您需要从名称中删除下划线 (_
),这应该可以解决您的问题。 (也感谢评论中的@yW0K5o)