I want to use the C# and .NET library Device.Net (Usb.Net and Hid.Net) on Windows, but I just cannot get even the first example working. The samples in the https://github.com/MelbourneDeveloper/Device.Net repository just wont build or run in Visual Studio.
What I did:
- installed Visual Studio 2019 Community 16.9.5 (Windows x64)
- installed almost all Workloads, because I don't know what's necessary: ASP.NET, Azure, .NET-Desktop, for Universal Windows Platform, Mobile-Development .NET, .NET Core
- Cloned the repository with Visual Studio
- Opened the Device.Net.All solution
- Installed the Windows SDK I was asked to (10.0.16299.0)
- right clicked on the Usb.Net.WindowsSample -> Build
- also tried Usb.Net.WindowsSample
I tried a few things before but never got it to work. I have almost no experience with Visual Studio, .NET or C#.
Errors (Visual Studio Output after clicking Build on the Usb.Net.WindowsSample):
Build started...
1>------ Build started: Project: Device.Net, Configuration: Debug Any CPU ------
1>C:\Users\Nico\.nuget\packages\microsoft.codeanalysis.netanalyzers\5.0.1\build\Microsoft.CodeAnalysis.NetAnalyzers.targets(57,5): warning : The .NET SDK has newer analyzers with version '5.0.2' than what version '5.0.1' of 'Microsoft.CodeAnalysis.NetAnalyzers' package provides. Update or remove this package reference.
1>C:\Users\Nico\.nuget\packages\microsoft.codeanalysis.netanalyzers\5.0.1\build\Microsoft.CodeAnalysis.NetAnalyzers.targets(57,5): warning : The .NET SDK has newer analyzers with version '5.0.2' than what version '5.0.1' of 'Microsoft.CodeAnalysis.NetAnalyzers' package provides. Update or remove this package reference.
1>E:\Coding\Fun_Practise\C#\Device.Net\src\Device.Net\ConnectedDeviceDefinition.cs(23,22,23,31): error CS1591: Missing XML comment for publicly visible type or member 'ConnectedDeviceDefinition.ClassGuid'
1>E:\Coding\Fun_Practise\C#\Device.Net\src\Device.Net\ConnectedDeviceDefinition.cs(82,16,82,41): error CS1591: Missing XML comment for publicly visible type or member 'ConnectedDeviceDefinition.ConnectedDeviceDefinition(string, DeviceType, uint?, uint?, string, string, string, ushort?, ushort?, ushort?, int?, int?, string, Guid?)'
1>E:\Coding\Fun_Practise\C#\Device.Net\src\Device.Net\ConnectedDeviceDefinition.cs(121,32,121,40): error CS1591: Missing XML comment for publicly visible type or member 'ConnectedDeviceDefinition.ToString()'
1>E:\Coding\Fun_Practise\C#\Device.Net\src\Device.Net\Delegates.cs(8,66,8,100): error CS1591: Missing XML comment for publicly visible type or member 'GetConnectedDeviceDefinitionsAsync'
1>E:\Coding\Fun_Practise\C#\Device.Net\src\Device.Net\Delegates.cs(9,47,9,66): error CS1591: Missing XML comment for publicly visible type or member 'GetDeviceDefinition'
1>E:\Coding\Fun_Practise\C#\Device.Net\src\Device.Net\Delegates.cs(10,35,10,49): error CS1591: Missing XML comment for publicly visible type or member 'GetDeviceAsync'
1>E:\Coding\Fun_Practise\C#\Device.Net\src\Device.Net\DeviceBase.cs(20,27,20,33): error CS1591: Missing XML comment for publicly visible type or member 'DeviceBase.Logger'
# ...
# Many more "Missing XML comment for publicly visible type or member" errors
# ...
1>E:\Coding\Fun_Practise\C#\Device.Net\src\Device.Net\Windows\WindowsDeviceEnumerator.cs(36,61,36,95): error CS1591: Missing XML comment for publicly visible type or member 'WindowsDeviceEnumerator.GetConnectedDeviceDefinitionsAsync(CancellationToken)'
1>E:\Coding\Fun_Practise\C#\Device.Net\src\Device.Net\Windows\WindowsHelpers.cs(8,25,8,39): error CS1591: Missing XML comment for publicly visible type or member 'WindowsHelpers'
1>E:\Coding\Fun_Practise\C#\Device.Net\src\Device.Net\Exceptions\ApiException.cs(6,18,6,30): error CS1591: Missing XML comment for publicly visible type or member 'ApiException'
1>E:\Coding\Fun_Practise\C#\Device.Net\src\Device.Net\DeviceBase.cs(76,29,76,36): error CA1063: Ensure that 'DeviceBase.Dispose' is declared as public and sealed
1>E:\Coding\Fun_Practise\C#\Device.Net\src\Device.Net\UnsubscribeDisposable.cs(5,18,5,39): error CA1063: Provide an overridable implementation of Dispose(bool) on 'UnsubscribeDisposable' or mark the type as sealed. A call to Dispose(false) should only clean up native resources. A call to Dispose(true) should clean up both managed and native resources.
1>E:\Coding\Fun_Practise\C#\Device.Net\src\Device.Net\Exceptions\ApiException.cs(8,16,8,28): error CS1591: Missing XML comment for publicly visible type or member 'ApiException.ApiException()'
1>E:\Coding\Fun_Practise\C#\Device.Net\src\Device.Net\UnsubscribeDisposable.cs(11,21,11,28): error CA1816: Change UnsubscribeDisposable.Dispose() to call GC.SuppressFinalize(object). This will prevent derived types that introduce a finalizer from needing to re-implement 'IDisposable' to call it.
1>E:\Coding\Fun_Practise\C#\Device.Net\src\Device.Net\UnsubscribeDisposable.cs(11,21,11,28): error CA1063: Modify 'UnsubscribeDisposable.Dispose' so that it calls Dispose(true), then calls GC.SuppressFinalize on the current object instance ('this' or 'Me' in Visual Basic), and then returns
1>E:\Coding\Fun_Practise\C#\Device.Net\src\Device.Net\Exceptions\ApiException.cs(12,16,12,28): error CS1591: Missing XML comment for publicly visible type or member 'ApiException.ApiException(string)'
1>E:\Coding\Fun_Practise\C#\Device.Net\src\Device.Net\DeviceBase.cs(96,13,96,38): error CA1816: DeviceBase.Dispose(bool) calls GC.SuppressFinalize(object), a method that is typically only called within an implementation of 'IDisposable.Dispose'. Refer to the IDisposable pattern for more information.
1>E:\Coding\Fun_Practise\C#\Device.Net\src\Device.Net\Exceptions\ApiException.cs(16,16,16,28): error CS1591: Missing XML comment for publicly visible type or member 'ApiException.ApiException(string, Exception)'
# ...
# Even more "Missing XML comment for publicly visible type or member" errors
# ...
1>E:\Coding\Fun_Practise\C#\Device.Net\src\Device.Net\Windows\WindowsDeviceEnumerator.cs(23,16,23,39): error CS1591: Missing XML comment for publicly visible type or member 'WindowsDeviceEnumerator.WindowsDeviceEnumerator(ILogger, Guid, GetDeviceDefinition, IsMatch)'
1>E:\Coding\Fun_Practise\C#\Device.Net\src\Device.Net\Windows\WindowsDeviceEnumerator.cs(36,61,36,95): error CS1591: Missing XML comment for publicly visible type or member 'WindowsDeviceEnumerator.GetConnectedDeviceDefinitionsAsync(CancellationToken)'
1>E:\Coding\Fun_Practise\C#\Device.Net\src\Device.Net\Windows\WindowsHelpers.cs(8,25,8,39): error CS1591: Missing XML comment for publicly visible type or member 'WindowsHelpers'
1>E:\Coding\Fun_Practise\C#\Device.Net\src\Device.Net\DeviceBase.cs(76,29,76,36): error CA1063: Ensure that 'DeviceBase.Dispose' is declared as public and sealed
1>E:\Coding\Fun_Practise\C#\Device.Net\src\Device.Net\UnsubscribeDisposable.cs(5,18,5,39): error CA1063: Provide an overridable implementation of Dispose(bool) on 'UnsubscribeDisposable' or mark the type as sealed. A call to Dispose(false) should only clean up native resources. A call to Dispose(true) should clean up both managed and native resources.
1>E:\Coding\Fun_Practise\C#\Device.Net\src\Device.Net\DeviceBase.cs(96,13,96,38): error CA1816: DeviceBase.Dispose(bool) calls GC.SuppressFinalize(object), a method that is typically only called within an implementation of 'IDisposable.Dispose'. Refer to the IDisposable pattern for more information.
1>E:\Coding\Fun_Practise\C#\Device.Net\src\Device.Net\UnsubscribeDisposable.cs(11,21,11,28): error CA1816: Change UnsubscribeDisposable.Dispose() to call GC.SuppressFinalize(object). This will prevent derived types that introduce a finalizer from needing to re-implement 'IDisposable' to call it.
1>E:\Coding\Fun_Practise\C#\Device.Net\src\Device.Net\UnsubscribeDisposable.cs(11,21,11,28): error CA1063: Modify 'UnsubscribeDisposable.Dispose' so that it calls Dispose(true), then calls GC.SuppressFinalize on the current object instance ('this' or 'Me' in Visual Basic), and then returns
1>Done building project "Device.Net.csproj" -- FAILED.
2>------ Build started: Project: Hid.Net, Configuration: Debug Any CPU ------
3>------ Build started: Project: Usb.Net, Configuration: Debug Any CPU ------
4>------ Build started: Project: SerialPort.Net, Configuration: Debug Any CPU ------
5>------ Build started: Project: Device.Net.Reactive, Configuration: Debug Any CPU ------
3>C:\Users\Nico\.nuget\packages\microsoft.codeanalysis.netanalyzers\5.0.1\build\Microsoft.CodeAnalysis.NetAnalyzers.targets(57,5): warning : The .NET SDK has newer analyzers with version '5.0.2' than what version '5.0.1' of 'Microsoft.CodeAnalysis.NetAnalyzers' package provides. Update or remove this package reference.
2>C:\Users\Nico\.nuget\packages\microsoft.codeanalysis.netanalyzers\5.0.1\build\Microsoft.CodeAnalysis.NetAnalyzers.targets(57,5): warning : The .NET SDK has newer analyzers with version '5.0.2' than what version '5.0.1' of 'Microsoft.CodeAnalysis.NetAnalyzers' package provides. Update or remove this package reference.
5>CSC : error CS0006: Metadata file 'E:\Coding\Fun_Practise\C#\Device.Net\src\Device.Net\bin\Debug\netstandard2.0\Device.Net.dll' could not be found
3>CSC : error CS0006: Metadata file 'E:\Coding\Fun_Practise\C#\Device.Net\src\Device.Net\bin\Debug\netstandard2.0\Device.Net.dll' could not be found
3>Done building project "Usb.Net.csproj" -- FAILED.
2>CSC : error CS0006: Metadata file 'E:\Coding\Fun_Practise\C#\Device.Net\src\Device.Net\bin\Debug\netstandard2.0\Device.Net.dll' could not be found
2>Done building project "Hid.Net.csproj" -- FAILED.
5>Done building project "Device.Net.Reactive.csproj" -- FAILED.
4>C:\Users\Nico\.nuget\packages\microsoft.codeanalysis.netanalyzers\5.0.1\build\Microsoft.CodeAnalysis.NetAnalyzers.targets(57,5): warning : The .NET SDK has newer analyzers with version '5.0.2' than what version '5.0.1' of 'Microsoft.CodeAnalysis.NetAnalyzers' package provides. Update or remove this package reference.
4>CSC : error CS0006: Metadata file 'E:\Coding\Fun_Practise\C#\Device.Net\src\Device.Net\bin\Debug\netstandard2.0\Device.Net.dll' could not be found
4>Done building project "SerialPort.Net.csproj" -- FAILED.
4>CSC : error CS0006: Metadata file 'E:\Coding\Fun_Practise\C#\Device.Net\src\Device.Net\bin\Debug\net45\Device.Net.dll' could not be found
4>Done building project "SerialPort.Net.csproj" -- FAILED.
3>CSC : error CS0006: Metadata file 'E:\Coding\Fun_Practise\C#\Device.Net\src\Device.Net\bin\Debug\net45\Device.Net.dll' could not be found
3>Done building project "Usb.Net.csproj" -- FAILED.
2>CSC : error CS0006: Metadata file 'E:\Coding\Fun_Practise\C#\Device.Net\src\Device.Net\bin\Debug\net45\Device.Net.dll' could not be found
2>Done building project "Hid.Net.csproj" -- FAILED.
6>------ Build started: Project: Usb.Net.WindowsSample, Configuration: Debug Any CPU ------
6>C:\Users\Nico\.nuget\packages\microsoft.codeanalysis.netanalyzers\5.0.1\build\Microsoft.CodeAnalysis.NetAnalyzers.targets(57,5): warning : The .NET SDK has newer analyzers with version '5.0.2' than what version '5.0.1' of 'Microsoft.CodeAnalysis.NetAnalyzers' package provides. Update or remove this package reference.
6>CSC : error CS0006: Metadata file 'E:\Coding\Fun_Practise\C#\Device.Net\src\Device.Net\bin\Debug\netstandard2.0\Device.Net.dll' could not be found
6>CSC : error CS0006: Metadata file 'E:\Coding\Fun_Practise\C#\Device.Net\src\Device.Net.Reactive\bin\Debug\netstandard2.0\Device.Net.Reactive.dll' could not be found
6>CSC : error CS0006: Metadata file 'E:\Coding\Fun_Practise\C#\Device.Net\src\Hid.Net\bin\Debug\netstandard2.0\Hid.Net.dll' could not be found
6>CSC : error CS0006: Metadata file 'E:\Coding\Fun_Practise\C#\Device.Net\src\SerialPort.Net\bin\Debug\netstandard2.0\SerialPort.Net.dll' could not be found
6>CSC : error CS0006: Metadata file 'E:\Coding\Fun_Practise\C#\Device.Net\src\Usb.Net\bin\Debug\netstandard2.0\Usb.Net.dll' could not be found
6>Done building project "Usb.Net.WindowsSample.csproj" -- FAILED.
========== Build: 0 succeeded, 6 failed, 0 up-to-date, 0 skipped ==========