I got below issue while executing my internal project
So I want to download System.Net.Http.WebRequest, But
I am getting below issue while downloading the package using visual studio PM
There is no need to download a package, those HTTP tools are in
System.Net namespace.
You can use WebRequest.Create() to create a new WebRequest.
Anyway those methods are obsolete you should use HttpClient
Here is the doc
Related
I've been struggling trying to get the small sample c# console code from Twilio using my Visual Studio 2017 Pro .NET framework 4.6.1. I keep getting this error message from the Package Manager Console.
An error occurred while trying to restore packages: Unable to find version '1.0.4' of package 'Twilio'/
C:\Program Files (x86)\Microsoft SDKs\NuGetPackages:Package 'Twilio.1.0.4' is not found on source 'C:\Program FIles (x86)\Microsoft SDKs\NuGetPackages'.
http://packagesource: Unable to load the service index for source http://packagesource.
An error occurred while sending the request.
The remote name could not be resolved: 'packagesource'
Any Idea how to fix this problem, has anyone been through this before or the real problem is with Twilio that is not very friendly with C#?
Thank you guys
I would recommend installing the latest version of the Twilio package which at the time of me writing this is 5.65. Try installing the latest version and see if that resolves the compilation error. I ran a test on my local machine using Visual Studio 2019 (Community Edition) and creating a brand new .NET Framework 4.6.1 console application. Using the NuGet Package Manager I installed the latest version of the Twilio NuGet package and built the project without error. I also used the code from the .NET Framework SMS Quick Start located here and it worked with one of my numbers.
As far as the package issue you may want to look here and see if that resolves the issue you're having. Note that one of the answers was to create a new application and reinstall the package using the package manager console rather than the NuGet Package Manager.
I'm writing C# code in a script task in SSIS. I need to use the Newtonsoft JSON package in the code so i have installed it from NuGet. When it is first installed it works fine, but when I close my code and re-open it to make a change, I have to re-install the package using update-package -Reinstall as per the Some NuGet packages are missing from the solution in Visual Studio Application post.
Why do I have to do this every time? Am I doing something wrong?
Thanks for your help.
I found that adding the assembly to the GAC manually fixed the issue for me. To do this:
Open the "Developer Command Prompt for VS (SSDT)" in admin mode.
Run this command: gacutil -i "assembly name"
For the assembly name, I just needed to browse my local drive for a copy of the DLL i was adding and then use the full file path (C:...Newtonsoft.json.dll) in the "assembly name".
https://learn.microsoft.com/en-us/dotnet/framework/app-domains/how-to-install-an-assembly-into-the-gac
https://learn.microsoft.com/en-us/dotnet/framework/tools/developer-command-prompt-for-vs
Try installing Json.Net from solution explorer:
json.net
How to Install Json.Net in Visual Studio Projects
Workaround
Instead of using Json.Net you can benefit from System.Web.Extension assembly which is a part of the .Net Framework, you can refer to the following link for a step by step guide on how to parse JSON using this assembly:
Importing JSON Files Using SQL Server Integration Services
I've searched for solutions on this but found no one getting this error and it is never very descriptive. Wanted to see if someone has a solution or point me to a resource that covers it.
Basically, I have a .Net Standard 2.0 Project that I'm installing Selenium WebDriver and ChromeDriver to. However, when I try to install them from Nuget Manager in VS2017 (either via Nuget.org or locally), I get the error below:
"The local source 'C:\Users\ME\Desktop\dist' doesn't exist."
I've tried placing ChromeDriver on the desktop thinking that was the cause but no change. Also tried command line install of the Nuget package but it fails as well.
Any assistance would be very helpful.
When you bring up the NuGet manager, make sure that your package source is set to nuget.org. It sounds like you've got it pointed to some local path that doesn't exist.
When compiling a Visual Studio 2010 source code from an existing project in Visual Studio 2015 I get this error:
CS0012 The type 'ExchangeService' is defined in an assembly that is not referenced. You must add a reference to assembly 'Microsoft.Exchange.WebServices, Version=15.0.0.0, Culture=neutral, PublicKeyToken=344fslr343344ff244'
Try adding the needed assembly but i can not find what assembly to add try different ones nothing working.
I searched the web and found similar issue but not the same so I post my specific issue here with attachment of the error and how to solve it.
To solve it i upgraded EWS version 1.2.0 to EWS version 2.2 in Visual Studio 2015 and I found version 2.2 via Nuget package manager please also see attachments.
Source: https://community.dynamics.com/ax/f/33/t/129706
Done.
error image:
resolution image:
Done.
attached is latest update for a newer version of Visual Studio 2019 and Exchange Web Services version 2.2.0
*** DO NOT USE THIS LIBRARY AS IN BELOW ATTACHMENT - download it here if you dont already have it or from VS integrated https://www.nuget.org/packages/Microsoft.Exchange.WebServices/
So I'm starting up a new .Net 4.0 project and will be doing some work with a public API. I'm planning on using the Microsoft HttpClient class so I installed the latest stable version of the Microsoft.Net.Http NuGet package (version 2.2.13). I'm looking at some POC code that a coworker put together, also using a NuGet package for HttpClient and notice that there's code like this:
HttpClient client = new HttpClient();
HttpResponseMessage response = client.GetAync("/uri").Result;
DomainType result = response.Content.ReadAsAsync<DomainType>().Result;
In my project, after adding the reference to the Microsoft.Net.Http package, when I try to write similar code, I noticed that HttpResponseMessage doesn't have a ReadAsAsync<T>() method. After doing some digging in my coworker's POC solution, it looks like ReadAsAsync<T>() is actually an extension method in the System.Net.Http.Formatting assembly. In this POC solution, there's a reference to System.Net.Http.Formatting, however it's pulling this file from the path C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC 4\Assemblies\System.Net.Http.Formatting.dll.
My question is, is there a better solution to getting access to this extension method than referencing this assembly from my local ASP.Net installation? My concern is that this is going to cause a problem on our CI server since it's not likely to have ASP.Net installed. I guess I could copy System.Net.Http.Formatting to a Lib directory in my solution but I'm hoping there's a better option such as another NuGet package I'm missing that would give me this assembly.
Thanks!
That's part of the WebAPI client libraries package. Install the Microsoft.AspNet.WebApi.Client nuget package.