Telegram.Bot icon indicating copy to clipboard operation
Telegram.Bot copied to clipboard

Telegram API issue - Could not load file or assembly 'System.Net.Http.Formatting, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35

Open vfuyong opened this issue 10 years ago • 5 comments

Steps to reproduce

Compile and produced Telegram.Bot.dll, Telegram.Bot.pdb, Telegram.Bot.xml Load Telegram.Bot.Dll into assembly from powershell, and call sendTextMessage

Expected behavior

Text message is sent

Actual behavior

An error is shown: Exception calling "SendTextMessage" with "4" argument(s): "Could not load file or assembly 'System.Net.Http.Formatting, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified." At line:3 char:1

  • $telegram.SendTextMessage('@someone', 'test api', $false, $false)
  • - CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    - FullyQualifiedErrorId : FileNotFoundException
    

Environment data

Powershell 5.1 Windows 10 anniversary update

NuGet Package Version: (e.g. 10.3.0) Unknown

.NET Version: (e.g. 4.6, Core RTM, Mono, etc.) 4.6.1

IDE: (e.g. VS2015, VS Code, etc.) VS2015 community

App: (e.g. Desktop, iOS, Android, etc.) NA

vfuyong avatar Sep 12 '16 00:09 vfuyong

As the error message suggests you also need to load the System.Net.Http.Formatting.dll

MrRoundRobin avatar Sep 12 '16 21:09 MrRoundRobin

@MrRoundRobin Will it make sense for API to check necessary DLLs loaded if not, load them?

vfuyong avatar Sep 12 '16 22:09 vfuyong

This is powershell specific. if you use the nuget package for normal development the dependencies are resolved correctly

MrRoundRobin avatar Sep 12 '16 22:09 MrRoundRobin

@MrRoundRobin Thanks :)

vfuyong avatar Sep 12 '16 23:09 vfuyong

@MrRoundRobin i also getting same issue and i am also adding reference System.Net.Http.Formatting, Version=5.2.3.0. so also then why accure this issue. i have no idea can you please give me some hint

Coderwill avatar Aug 30 '17 09:08 Coderwill