Replace WebClient with HttpClient to fix WebClient obsolete warning
This commit is contained in:
parent
042639edf1
commit
383cb48f5a
1 changed files with 3 additions and 2 deletions
|
@ -15,6 +15,7 @@ using System.IO;
|
||||||
using System.IO.Compression;
|
using System.IO.Compression;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
|
using System.Net.Http;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
using Task = Microsoft.Build.Utilities.Task;
|
using Task = Microsoft.Build.Utilities.Task;
|
||||||
|
@ -87,8 +88,8 @@ namespace Microsoft.DotNet.SourceBuild.Tasks.UsageReport
|
||||||
/// <returns>The contents of the specified file.</returns>
|
/// <returns>The contents of the specified file.</returns>
|
||||||
private string GetFileContents(string relativeFilePath, string commitSha)
|
private string GetFileContents(string relativeFilePath, string commitSha)
|
||||||
{
|
{
|
||||||
WebClient client = new WebClient();
|
HttpClient client = new HttpClient();
|
||||||
var xmlString = client.DownloadString($"https://raw.githubusercontent.com/dotnet/source-build/{commitSha}/{relativeFilePath.Replace('\\', '/')}");
|
string xmlString = client.GetStringAsync($"https://raw.githubusercontent.com/dotnet/source-build/{commitSha}/{relativeFilePath.Replace('\\', '/')}").Result;
|
||||||
return xmlString;
|
return xmlString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue