Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions source/TestAdapter/NanoCLRHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System;
using System.ComponentModel;
using System.Net;
using System.Net.Http;
using System.Text.RegularExpressions;
using System.Threading;
using CliWrap;
Expand Down Expand Up @@ -55,23 +56,23 @@ public static bool InstallNanoClr(LogMessenger logger)
string responseContent = null;

// check latest version
using (System.Net.WebClient client = new WebClient())
using (HttpClient client = new HttpClient())
{
try
{
// Set the user agent string to identify the client.
client.Headers.Add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36");
client.DefaultRequestHeaders.Add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36");

// Set any additional headers, if needed.
client.Headers.Add("Content-Type", "application/json");
client.DefaultRequestHeaders.Add("Content-Type", "application/json");

// Set the URL to request.
string url = "https://api.nuget.org/v3-flatcontainer/nanoclr/index.json";

// Make the HTTP request and retrieve the response.
responseContent = client.DownloadString(url);
responseContent = client.GetStringAsync(url).Result;
}
catch (WebException e)
catch (HttpRequestException e)
{
// Handle any exceptions that occurred during the request.
Console.WriteLine(e.Message);
Expand Down
3 changes: 2 additions & 1 deletion source/TestAdapter/nanoFramework.TestAdapter.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net48;net6.0</TargetFrameworks>
Expand All @@ -22,6 +22,7 @@
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />
</ItemGroup>

<Import Project="..\TestFrameworkShared\TestFrameworkShared.projitems" Label="Shared" />
Expand Down
Loading