I have a class library project where I have all the Google voice2text transcribe api. When I am building the class library dll and using it to another application following error is throwing.
Could not load file or assembly 'Google.Apis.Auth, Version=1.40.2.0, Culture=neutral, PublicKeyToken=4b01fa6e34db77ab' or one of its dependencies. The system cannot find the file specified.
It sounds like you haven't got the transitive dependencies working properly. In order to know how to fix this best, we need more context:
With .NET Core SDK style projects, if you add a reference to the class library project I'd expect the .NET Core SDK to then restore all the transitive dependencies. If you're using a classic SDK style project, I believe you'll need to add dependencies in your application as well. Just adding a dependency on Google.Cloud.Speech.V1 should be enough, I believe.
It's a normal .Net Framework 4.6.1 project and I have used Nuget package manager to install all the Google Transcribe api. The project itself working fine when I am treating this as a Console application but when making it a class library and using project dll on another project reference then from that external project the error is throwing.
Yes, that's because classic projects didn't treat NuGet package references transitively. Options:
Personally I'd recommend converting to .NET Core SDK style projects - the project files are much easier to work with, as well as fixing this issue.
Thank you very much. :)
I'll close this issue for now as those options should fix it; please add another comment if you run into trouble, and I can reopen.