NuGet / Home

Repo for NuGet Client issues
Other
1.5k stars 252 forks source link

Referencing DeepSpeech.0.9.3 NuGet Package in netcoreapp3.1 results in CS0246 'DeepSpeechClient' could not be found #10421

Closed aolszowka closed 3 years ago

aolszowka commented 3 years ago

Hi

It is unclear if this is an authoring issue with the package or there is an underlying NuGet PackageReference Issue. I have opened an issue with the DeepSpeech team here: https://github.com/mozilla/DeepSpeech/issues/3483 there is a significant amount of chatter on this issue which might be related: https://github.com/mozilla/DeepSpeech/pull/3373 they are expressing concerns about how to best distribute cross platform, can someone from the NuGet team address some of those concerns?

I am attempting to use Mozilla’s DeepSpeech API via their prebuilt package available at https://www.nuget.org/packages/DeepSpeech in a .NET Core Project (specifically a netcoreapp3.1) however I am getting errors indicating that it cannot find DeepSpeechClient which would indicate something is not right with the Package Restore.

Specifically the error is

Severity    Code    Description Project File    Line    Suppression State
Error   CS0246  The type or namespace name 'DeepSpeechClient' could not be found (are you missing a using directive or an assembly reference?)  PackageRefIssue C:\GitHub\DeepSpeech093NetCorePackageRefIssue\PackageRefIssue\Program.cs    1   Active

I have created this public repository that shows the issue: https://github.com/aolszowka/DeepSpeech093NetCorePackageRefIssue/tree/main

This fails on my local machine which is running Visual Studio 2019 Enterprise 16.8.3 on Windows 10.

This issue can be hacked around by adding an AssemblyReference to DeepSpeechClient from the NuGet “GAC”. I have demonstrated this fix here: https://github.com/aolszowka/DeepSpeech093NetCorePackageRefIssue/tree/Workaround-Using-Assembly-Path however this is less than ideal as you are not leveraging the package manager.

To me this indicates an issue with the package manager and not a .NET Core limitation.

The expectation is that you should be able to clone the above project (on the main branch) and be able to build without issue.

Thank you

heng-liu commented 3 years ago

Hi, from DeepSpeech repository, the project is targeting net452;net46;net47;uap10.0. So there is no compatible dlls in the package. (NuGet finds for closest compatible TFM, but none of the dlls under lib/net45, lib/net46, lib/net47, lib/uap10.0 are compatible with netcoreapp3.1. You may try the tool in doc https://docs.microsoft.com/en-us/nuget/create-packages/supporting-multiple-target-frameworks to check if any of the dlls will be selected. image

Sorry, but you have to wait until the package owner makes the package support netcoreapp3.1.