未验证 提交 cc07422d 编写于 作者: P Patrick Grawehr 提交者: GitHub

Update Microsoft.Extensions.Logging to v7.0.0, drop netcoreap3.1 support (#1990)

* Update Microsoft.Extensions.Logging to v7.0.0

* Fix nullability warnings

Now only warns about untested netcoreapp3.1 compatibility

* Update template project

And remove explicit hints that make the tests optional,
since most bindings will have some methods that are testable.

* Update TFM for tests to .NET 6.0

* Make test compile for .NET4.8

* Workaround for missing File.WriteAllTextAsync.

Causes a compatibility regression when a netcoreapp3.1 application
now reverts to use the netstandard2.0 library.

* Move samples to separate folder

(Another instance of the macos compiler failure that occurs if
two projects share the same physical folder)
Co-authored-by: NMatt Galbraith <MattGal@users.noreply.github.com>
上级 ae7b4afc
......@@ -12,11 +12,11 @@
<SystemRuntimeWindowsRuntimePackageVersion>4.6.0</SystemRuntimeWindowsRuntimePackageVersion>
<SystemManagementPackageVersion>5.0.0</SystemManagementPackageVersion>
<SystemThreadingTasksExtensionsPackageVersion>4.5.4</SystemThreadingTasksExtensionsPackageVersion>
<SystemMemoryPackageVersion>4.5.4</SystemMemoryPackageVersion>
<SystemMemoryPackageVersion>4.5.5</SystemMemoryPackageVersion>
<SystemRuntimeInteropServicesWindowsRuntimePackageVersion>4.3.0</SystemRuntimeInteropServicesWindowsRuntimePackageVersion>
<MicrosoftExtensionsLoggingConsolePackageVersion>5.0.0</MicrosoftExtensionsLoggingConsolePackageVersion>
<MicrosoftExtensionsLoggingPackageVersion>5.0.0</MicrosoftExtensionsLoggingPackageVersion>
<MicrosoftExtensionsLoggingAbstractionsPackageVersion>5.0.0</MicrosoftExtensionsLoggingAbstractionsPackageVersion>
<MicrosoftExtensionsLoggingConsolePackageVersion>7.0.0</MicrosoftExtensionsLoggingConsolePackageVersion>
<MicrosoftExtensionsLoggingPackageVersion>7.0.0</MicrosoftExtensionsLoggingPackageVersion>
<MicrosoftExtensionsLoggingAbstractionsPackageVersion>7.0.0</MicrosoftExtensionsLoggingAbstractionsPackageVersion>
<SystemTextJsonPackageVersion>6.0.1</SystemTextJsonPackageVersion>
</PropertyGroup>
</Project>
......@@ -12,7 +12,7 @@
<IncludeDotNetCli>true</IncludeDotNetCli>
<DotNetCliPackageType>sdk</DotNetCliPackageType>
<DotNetCliVersion>3.1.405</DotNetCliVersion>
<DotNetCliVersion>6.0.400</DotNetCliVersion>
<EnableAzurePipelinesReporter Condition="'$(SYSTEM_ACCESSTOKEN)' != ''">true</EnableAzurePipelinesReporter>
<TestRunNamePrefix>$(AGENT_JOBNAME)</TestRunNamePrefix>
......@@ -34,7 +34,7 @@
<ItemGroup Condition="'$(TestOS)' == 'Unix'">
<!-- Xunit project to test -->
<XUnitProject Include="..\src\System.Device.Gpio.Tests\System.Device.Gpio.Tests.csproj">
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<RuntimeTargetFramework>netcoreapp2.0</RuntimeTargetFramework>
</XUnitProject>
<!-- Target queues -->
......
<?xml version="1.0" encoding="utf-8"?>
<Suppressions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Suppression>
<DiagnosticId>CP0001</DiagnosticId>
<Target>T:Iot.Device.Common.ValueArray`1</Target>
<Left>lib/net6.0/Iot.Device.Bindings.dll</Left>
<Right>lib/net6.0/Iot.Device.Bindings.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0001</DiagnosticId>
<Target>T:Iot.Device.Display.BarColor</Target>
<Left>lib/net6.0/Iot.Device.Bindings.dll</Left>
<Right>lib/net6.0/Iot.Device.Bindings.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0001</DiagnosticId>
<Target>T:IoT.Device.Pn532.ErrorCode</Target>
<Left>lib/net6.0/Iot.Device.Bindings.dll</Left>
<Right>lib/net6.0/Iot.Device.Bindings.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0001</DiagnosticId>
<Target>T:IoT.Device.Tsl256x.Channel</Target>
......@@ -49,11 +70,25 @@
<Right>lib/net6.0/Iot.Device.Bindings.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0001</DiagnosticId>
<Target>T:Iot.Device.Common.ValueArray`1</Target>
<Left>lib/netcoreapp3.1/Iot.Device.Bindings.dll</Left>
<Right>lib/netcoreapp3.1/Iot.Device.Bindings.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0001</DiagnosticId>
<Target>T:Iot.Device.Display.BarColor</Target>
<Left>lib/netcoreapp3.1/Iot.Device.Bindings.dll</Left>
<Right>lib/netcoreapp3.1/Iot.Device.Bindings.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0001</DiagnosticId>
<Target>T:IoT.Device.Pn532.ErrorCode</Target>
<Left>lib/net6.0/Iot.Device.Bindings.dll</Left>
<Right>lib/net6.0/Iot.Device.Bindings.dll</Right>
<Left>lib/netcoreapp3.1/Iot.Device.Bindings.dll</Left>
<Right>lib/netcoreapp3.1/Iot.Device.Bindings.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
......@@ -107,9 +142,30 @@
</Suppression>
<Suppression>
<DiagnosticId>CP0001</DiagnosticId>
<Target>T:IoT.Device.Pn532.ErrorCode</Target>
<Target>T:Iot.Device.Display.BarColor</Target>
<Left>lib/netcoreapp3.1/Iot.Device.Bindings.dll</Left>
<Right>lib/netcoreapp3.1/Iot.Device.Bindings.dll</Right>
<Right>lib/netstandard2.0/Iot.Device.Bindings.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0001</DiagnosticId>
<Target>T:Iot.Device.Common.ValueArray`1</Target>
<Left>lib/netstandard2.0/Iot.Device.Bindings.dll</Left>
<Right>lib/netstandard2.0/Iot.Device.Bindings.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0001</DiagnosticId>
<Target>T:Iot.Device.Display.BarColor</Target>
<Left>lib/netstandard2.0/Iot.Device.Bindings.dll</Left>
<Right>lib/netstandard2.0/Iot.Device.Bindings.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0001</DiagnosticId>
<Target>T:IoT.Device.Pn532.ErrorCode</Target>
<Left>lib/netstandard2.0/Iot.Device.Bindings.dll</Left>
<Right>lib/netstandard2.0/Iot.Device.Bindings.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
......@@ -161,13 +217,6 @@
<Right>lib/netstandard2.0/Iot.Device.Bindings.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0001</DiagnosticId>
<Target>T:IoT.Device.Pn532.ErrorCode</Target>
<Left>lib/netstandard2.0/Iot.Device.Bindings.dll</Left>
<Right>lib/netstandard2.0/Iot.Device.Bindings.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>F:Iot.Device.Imu.Mpu6500.DefaultI2cAddress</Target>
......@@ -184,91 +233,56 @@
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>F:Iot.Device.Imu.Mpu6500.DefaultI2cAddress</Target>
<Left>lib/netcoreapp3.1/Iot.Device.Bindings.dll</Left>
<Right>lib/netcoreapp3.1/Iot.Device.Bindings.dll</Right>
<Target>M:Iot.Device.Display.BiColorBarGraph.Fill(Iot.Device.Display.BarColor)</Target>
<Left>lib/net6.0/Iot.Device.Bindings.dll</Left>
<Right>lib/net6.0/Iot.Device.Bindings.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>F:Iot.Device.Imu.Mpu6500.SecondI2cAddress</Target>
<Target>F:Iot.Device.Imu.Mpu6500.DefaultI2cAddress</Target>
<Left>lib/netcoreapp3.1/Iot.Device.Bindings.dll</Left>
<Right>lib/netcoreapp3.1/Iot.Device.Bindings.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>F:Iot.Device.Imu.Mpu6500.DefaultI2cAddress</Target>
<Left>lib/netstandard2.0/Iot.Device.Bindings.dll</Left>
<Right>lib/netstandard2.0/Iot.Device.Bindings.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>F:Iot.Device.Imu.Mpu6500.SecondI2cAddress</Target>
<Left>lib/netstandard2.0/Iot.Device.Bindings.dll</Left>
<Right>lib/netstandard2.0/Iot.Device.Bindings.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0001</DiagnosticId>
<Target>T:Iot.Device.Common.ValueArray`1</Target>
<Left>lib/net6.0/Iot.Device.Bindings.dll</Left>
<Right>lib/net6.0/Iot.Device.Bindings.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0001</DiagnosticId>
<Target>T:Iot.Device.Common.ValueArray`1</Target>
<Left>lib/netcoreapp3.1/Iot.Device.Bindings.dll</Left>
<Right>lib/netcoreapp3.1/Iot.Device.Bindings.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0001</DiagnosticId>
<Target>T:Iot.Device.Common.ValueArray`1</Target>
<Left>lib/netstandard2.0/Iot.Device.Bindings.dll</Left>
<Right>lib/netstandard2.0/Iot.Device.Bindings.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Iot.Device.Display.BiColorBarGraph.Fill(Iot.Device.Display.BarColor)</Target>
<Left>lib/net6.0/Iot.Device.Bindings.dll</Left>
<Right>lib/net6.0/Iot.Device.Bindings.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0001</DiagnosticId>
<Target>T:Iot.Device.Display.BarColor</Target>
<Left>lib/net6.0/Iot.Device.Bindings.dll</Left>
<Right>lib/net6.0/Iot.Device.Bindings.dll</Right>
<Left>lib/netcoreapp3.1/Iot.Device.Bindings.dll</Left>
<Right>lib/netcoreapp3.1/Iot.Device.Bindings.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Iot.Device.Display.BiColorBarGraph.Fill(Iot.Device.Display.BarColor)</Target>
<Left>lib/netcoreapp3.1/Iot.Device.Bindings.dll</Left>
<Right>lib/netcoreapp3.1/Iot.Device.Bindings.dll</Right>
<Right>lib/netstandard2.0/Iot.Device.Bindings.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0001</DiagnosticId>
<Target>T:Iot.Device.Display.BarColor</Target>
<Left>lib/netcoreapp3.1/Iot.Device.Bindings.dll</Left>
<Right>lib/netcoreapp3.1/Iot.Device.Bindings.dll</Right>
<DiagnosticId>CP0002</DiagnosticId>
<Target>F:Iot.Device.Imu.Mpu6500.DefaultI2cAddress</Target>
<Left>lib/netstandard2.0/Iot.Device.Bindings.dll</Left>
<Right>lib/netstandard2.0/Iot.Device.Bindings.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Iot.Device.Display.BiColorBarGraph.Fill(Iot.Device.Display.BarColor)</Target>
<Target>F:Iot.Device.Imu.Mpu6500.SecondI2cAddress</Target>
<Left>lib/netstandard2.0/Iot.Device.Bindings.dll</Left>
<Right>lib/netstandard2.0/Iot.Device.Bindings.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0001</DiagnosticId>
<Target>T:Iot.Device.Display.BarColor</Target>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Iot.Device.Display.BiColorBarGraph.Fill(Iot.Device.Display.BarColor)</Target>
<Left>lib/netstandard2.0/Iot.Device.Bindings.dll</Left>
<Right>lib/netstandard2.0/Iot.Device.Bindings.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
......
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;net6.0;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net6.0</TargetFrameworks>
<LangVersion>10</LangVersion>
<Nullable>enable</Nullable>
<DefineConstants>$(DefineConstants);BUILDING_IOT_DEVICE_BINDINGS</DefineConstants>
......
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<LangVersion>10</LangVersion>
<IsPackable>false</IsPackable>
<!-- Keep quiet about duplicate package references from props files -->
......
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>$(DefaultTestTfms)</TargetFramework>
<IsPackable>false</IsPackable>
<GenerateDocumentationFile>false</GenerateDocumentationFile>
</PropertyGroup>
......
......@@ -12,8 +12,8 @@
<ItemGroup>
<ProjectReference Include="..\Arduino.csproj" />
<ProjectReference Include="..\..\..\..\tools\ArduinoCsCompiler\Frontend\Frontend.csproj" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="$(MicrosoftExtensionsLoggingPackageVersion)" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="$(MicrosoftExtensionsLoggingConsolePackageVersion)" />
<PackageReference Include="System.IO.Ports" Version="$(SystemIOPortsPackageVersion)" />
</ItemGroup>
</Project>
\ No newline at end of file
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>$(DefaultTestTfms)</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' == 'Windows_NT'">$(TargetFrameworks);net48</TargetFrameworks>
<LangVersion>9</LangVersion>
<IsPackable>false</IsPackable>
......
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>$(DefaultTestTfms)</TargetFramework>
<IsPackable>false</IsPackable>
<LangVersion>latest</LangVersion>
<GenerateDocumentationFile>false</GenerateDocumentationFile>
......
......@@ -6,7 +6,6 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging" Version="6.0.0" />
<PackageReference Include="System.IO.Ports" Version="$(SystemIOPortsPackageVersion)" />
<Compile Include="Brick.cs" />
<Compile Include="Resource.Designer.cs">
......
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>$(DefaultTestTfms)</TargetFramework>
<IsPackable>false</IsPackable>
<LangVersion>latest</LangVersion>
<GenerateDocumentationFile>false</GenerateDocumentationFile>
......
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>$(DefaultTestTfms)</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
......
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>$(DefaultTestTfms)</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' == 'Windows_NT'">$(TargetFrameworks);net48</TargetFrameworks>
<LangVersion>9</LangVersion>
<IsPackable>false</IsPackable>
......
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>$(DefaultTestTfms)</TargetFramework>
<LangVersion>9</LangVersion>
<IsPackable>false</IsPackable>
</PropertyGroup>
......
......@@ -25,7 +25,7 @@
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<Compile Include="FrameworkCompatibilityExtensions.cs" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1' Or '$(TargetFramework)' == 'netstandard2.0'">
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<Compile Include="IsExternalInit.cs" />
</ItemGroup>
<ItemGroup Condition="$(TargetFramework) == 'netstandard2.0'">
......
......@@ -34,7 +34,8 @@ namespace Iot.Device.Common
}
/// <inheritdoc />
public IDisposable BeginScope<TState>(TState state)
public IDisposable? BeginScope<TState>(TState state)
where TState : notnull
{
return new LogDispatcher.ScopeDisposable();
}
......@@ -46,7 +47,7 @@ namespace Iot.Device.Common
}
/// <inheritdoc />
public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func<TState, Exception, string> formatter)
public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception? exception, Func<TState, Exception?, string> formatter)
{
string msg = formatter(state, exception);
Debug.WriteLine(msg);
......
......@@ -55,7 +55,7 @@ namespace Iot.Device.Common
private class NullLogger : ILogger
{
public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func<TState, Exception, string> formatter)
public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception? exception, Func<TState, Exception?, string> formatter)
{
}
......@@ -64,7 +64,8 @@ namespace Iot.Device.Common
return false;
}
public IDisposable BeginScope<TState>(TState state)
public IDisposable? BeginScope<TState>(TState state)
where TState : notnull
{
return new ScopeDisposable();
}
......
......@@ -44,7 +44,7 @@ namespace Iot.Device.Common
public string LoggerName { get; }
/// <inheritdoc />
public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func<TState, Exception, string> formatter)
public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception? exception, Func<TState, Exception?, string> formatter)
{
if (!IsEnabled(logLevel))
{
......@@ -83,7 +83,8 @@ namespace Iot.Device.Common
}
/// <inheritdoc />
public IDisposable BeginScope<TState>(TState state)
public IDisposable? BeginScope<TState>(TState state)
where TState : notnull
{
return new LogDispatcher.ScopeDisposable();
}
......
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>$(DefaultTestTfms)</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' == 'Windows_NT'">$(TargetFrameworks);net48</TargetFrameworks>
<IsPackable>false</IsPackable>
<GenerateDocumentationFile>false</GenerateDocumentationFile>
......
......@@ -5,8 +5,9 @@
<Import Project="../../eng/Versions.external.props" />
<PropertyGroup>
<!-- Most projects should use this value to build for all possible target frameworks -->
<DefaultBindingTfms>net6.0;netcoreapp3.1;netstandard2.0;</DefaultBindingTfms>
<DefaultBindingTfms>net6.0;netstandard2.0;</DefaultBindingTfms>
<DefaultSampleTfms>net6.0</DefaultSampleTfms>
<DefaultTestTfms>net6.0</DefaultTestTfms>
<NoWarn>$(NoWarn);CS8321</NoWarn>
<DeterministicSourcePaths>false</DeterministicSourcePaths>
<IsPackable>false</IsPackable>
......
......@@ -5,15 +5,17 @@ VisualStudioVersion = 15.0.26124.0
MinimumVisualStudioVersion = 15.0.26124.0
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{20F2E85F-D100-4EE6-BF7D-8BB8748D626C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Large4Digit7SegmentDisplay.sample", "samples\Large4Digit7SegmentDisplay.sample.csproj", "{C4D7AED7-B340-4DCD-974C-5150C6D5F074}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Large4Digit7SegmentDisplay.sample", "samples\Large4Digit7SegmentDisplay\Large4Digit7SegmentDisplay.sample.csproj", "{C4D7AED7-B340-4DCD-974C-5150C6D5F074}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Matrix.sample", "samples\Matrix.sample.csproj", "{C4D7AED7-B340-4DCD-974C-5150C6D5F074}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Matrix.sample", "samples\Matrix\Matrix.sample.csproj", "{C4D7AED7-B340-4DCD-974C-5150C6D5F074}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Matrix8x8Bicolor.sample", "samples\Matrix8x8Bicolor\Matrix8x8Bicolor.sample.csproj", "{C4D7AED7-B340-4DCD-974C-5150C6D5F074}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Matrix8x8Bicolor.sample", "samples\Matrix8x8Bicolor.sample.csproj", "{C4D7AED7-B340-4DCD-974C-5150C6D5F074}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BiColorBargraph.sample", "samples\BiColorBargraph.sample.csproj", "{C4D7AED7-B340-4DCD-974C-5150C6D5F074}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Display", "Display.csproj", "{4AAE8B9E-8540-4582-8083-D1F14104BAAC}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
......
......@@ -5,7 +5,7 @@
<EnableDefaultItems>false</EnableDefaultItems>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Display.csproj" />
<ProjectReference Include="..\..\Display.csproj" />
<Compile Include="Program.BiColorBargraph.cs" />
</ItemGroup>
</Project>
......@@ -5,7 +5,7 @@
<EnableDefaultItems>false</EnableDefaultItems>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Display.csproj" />
<ProjectReference Include="..\..\Display.csproj" />
<Compile Include="Program.cs" />
</ItemGroup>
</Project>
......@@ -5,7 +5,7 @@
<EnableDefaultItems>false</EnableDefaultItems>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Display.csproj" />
<ProjectReference Include="..\..\Display.csproj" />
<Compile Include="Program.Matrix.cs" />
</ItemGroup>
</Project>
......@@ -5,7 +5,7 @@
<EnableDefaultItems>false</EnableDefaultItems>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Display.csproj" />
<ProjectReference Include="..\..\Display.csproj" />
<Compile Include="Program.Matrix8x8Bicolor.cs" />
</ItemGroup>
</Project>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>$(DefaultTestTfms)</TargetFramework>
<LangVersion>10</LangVersion>
<IsPackable>false</IsPackable>
<GenerateDocumentationFile>false</GenerateDocumentationFile>
......
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>$(DefaultTestTfms)</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' == 'Windows_NT'">$(TargetFrameworks);net48</TargetFrameworks>
<LangVersion>9</LangVersion>
<IsPackable>false</IsPackable>
......
......@@ -162,7 +162,7 @@ namespace Iot.Device.Nmea0183.Tests
private RawSentence GnssRawSentence()
{
return new RawSentence(TalkerId.GlobalPositioningSystem, new SentenceId("GGA"),
"163824, 4728.7024, N, 00929.9665, E, 2, 12, 0.6, 398.5, M, 46.8, M,,".Split(',', StringSplitOptions.None),
"163824, 4728.7024, N, 00929.9665, E, 2, 12, 0.6, 398.5, M, 46.8, M,,".Split(new char[] { ',' }, StringSplitOptions.None),
new DateTimeOffset(2020, 04, 26, 16, 38, 24, TimeSpan.Zero));
}
}
......
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netcoreapp3.1;net6.0</TargetFrameworks>
<TargetFrameworks>$(DefaultTestTfms)</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' == 'Windows_NT'">$(TargetFrameworks);net48</TargetFrameworks>
<IsPackable>false</IsPackable>
<LangVersion>latest</LangVersion>
<GenerateDocumentationFile>false</GenerateDocumentationFile>
......
......@@ -29,13 +29,21 @@ namespace Iot.Device.OneWire
return Temperature.FromDegreesCelsius(temp * 0.001);
}
#if !NETSTANDARD2_0
private async Task<Temperature> ReadTemperatureInternalAsync()
{
#if NETSTANDARD2_0
string data = string.Empty;
await Task.Factory.StartNew(() =>
{
data = File.ReadAllText(Path.Combine(OneWireBus.SysfsDevicesPath, BusId, DeviceId, "w1_slave"));
});
return ParseTemperature(data);
#else
var data = await File.ReadAllTextAsync(Path.Combine(OneWireBus.SysfsDevicesPath, BusId, DeviceId, "w1_slave"));
return ParseTemperature(data);
}
#endif
}
private Temperature ReadTemperatureInternal()
{
......
......@@ -59,7 +59,6 @@ namespace Iot.Device.OneWire
}
}
#if !NETSTANDARD2_0
/// <summary>
/// Reads the current temperature of the device.
/// Expect this function to be slow (about one second).
......@@ -69,7 +68,6 @@ namespace Iot.Device.OneWire
{
return ReadTemperatureInternalAsync();
}
#endif
/// <summary>
/// Reads the current temperature of the device.
......
......@@ -40,17 +40,27 @@ namespace Iot.Device.OneWire
return (DeviceFamily)devFamily;
}
#if !NETSTANDARD2_0
internal static async Task ScanForDeviceChangesInternalAsync(OneWireBus bus, int numDevices, int numScans)
{
#if NETSTANDARD2_0
await Task.Factory.StartNew(() =>
{
if (numDevices > 0)
{
File.WriteAllText(Path.Combine(SysfsDevicesPath, bus.BusId, "w1_master_max_slave_count"), numDevices.ToString());
}
File.WriteAllText(Path.Combine(SysfsDevicesPath, bus.BusId, "w1_master_search"), numScans.ToString());
});
#else
if (numDevices > 0)
{
await File.WriteAllTextAsync(Path.Combine(SysfsDevicesPath, bus.BusId, "w1_master_max_slave_count"), numDevices.ToString());
}
await File.WriteAllTextAsync(Path.Combine(SysfsDevicesPath, bus.BusId, "w1_master_search"), numScans.ToString());
}
#endif
}
internal static void ScanForDeviceChangesInternal(OneWireBus bus, int numDevices, int numScans)
{
......
......@@ -42,7 +42,6 @@ namespace Iot.Device.OneWire
}
}
#if !NETSTANDARD2_0
/// <summary>
/// Start a new scan for device changes on the bus.
/// </summary>
......@@ -50,7 +49,6 @@ namespace Iot.Device.OneWire
/// <param name="numScans">Number of scans to do to find numDevices devices. Use -1 for platform default.</param>
/// <returns>Task representing the async work.</returns>
public Task ScanForDeviceChangesAsync(int numDevices = -1, int numScans = -1) => ScanForDeviceChangesInternalAsync(this, numDevices, numScans);
#endif
/// <summary>
/// Start a new scan for device changes on the bus.
......
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>$(DefaultTestTfms)</TargetFramework>
<LangVersion>10</LangVersion>
<IsPackable>false</IsPackable>
<GenerateDocumentationFile>false</GenerateDocumentationFile>
......
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>$(DefaultTestTfms)</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' == 'Windows_NT'">$(TargetFrameworks);net48</TargetFrameworks>
<LangVersion>9</LangVersion>
<IsPackable>false</IsPackable>
......
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>$(DefaultTestTfms)</TargetFramework>
<LangVersion>9</LangVersion>
<IsPackable>false</IsPackable>
<GenerateDocumentationFile>false</GenerateDocumentationFile>
......
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>$(DefaultTestTfms)</TargetFramework>
<LangVersion>9</LangVersion>
<IsPackable>false</IsPackable>
<GenerateDocumentationFile>false</GenerateDocumentationFile>
......
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>$(DefaultTestTfms)</TargetFramework>
<LangVersion>9</LangVersion>
<IsPackable>false</IsPackable>
<GenerateDocumentationFile>false</GenerateDocumentationFile>
......
......@@ -18,8 +18,8 @@
<ProjectReference Include="..\..\..\src\devices\Board\Board.csproj" />
<ProjectReference Include="..\..\..\src\devices\CharacterLcd\CharacterLcd.csproj" />
<ProjectReference Include="..\ArduinoCsCompiler.csproj" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="$(MicrosoftExtensionsLoggingPackageVersion)" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="$(MicrosoftExtensionsLoggingConsolePackageVersion)" />
<PackageReference Include="System.IO.Ports" Version="$(SystemIOPortsPackageVersion)" />
<ProjectReference Include="..\..\..\src\System.Device.Gpio\System.Device.Gpio.csproj" />
......
......@@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<LangVersion>9</LangVersion>
<Configurations>Debug;Release</Configurations>
<Copyright>The .NET Foundation</Copyright>
......
......@@ -50,10 +50,11 @@ iot/
Foo.Sample.cs
Foo.Samples.csproj
tests/ <-- Tests are optional
Foo_Not_Required.Tests.csproj
Foo.Tests.csproj
Foo.Tests.cs
```
## Tests Project
There is an optional test project created when the device binding project is created. The tests folder can be deleted if not used.
There is a test project created when the device binding project is created. The amount and number of tests that are expected will
depend on the type of binding.
......@@ -7,7 +7,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "_DeviceBinding", "_DeviceBi
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{03107CFF-FE00-467D-9B38-C00F7E12A7FE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "_DeviceBinding_Not_Required.Tests", "tests\_DeviceBinding_Not_Required.Tests.csproj", "{2B0F5D91-F38B-427D-84DB-5656D9661E1C}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "_DeviceBinding.Tests", "tests\_DeviceBinding.Tests.csproj", "{2B0F5D91-F38B-427D-84DB-5656D9661E1C}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{6A4DE7B1-03F3-4EE0-BF73-A0BAEF88BA2B}"
EndProject
......
<Project Sdk="Microsoft.NET.Sdk">
<!--
// NOTE: THIS TEST PROJECT IS NOT REQUIRED AND CAN BE DELETED IF NOT USED.
-->
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>$(DefaultSampleTfms)</TargetFramework>
<LangVersion>10</LangVersion>
<IsPackable>false</IsPackable>
<GenerateDocumentationFile>false</GenerateDocumentationFile>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册