に存在していない私は、Fedora 25には、公式のパッケージが存在しないとして、私は私の配布のためのRPMでDOTNETをインストールするためにthese instructionsを使用のFedora 25にDOTNETを使用しています:DOTNET:WebClientのはSystem.Net
物事は罰金見える:私はを追加
using System;
using System.Net;
using System.Net.Http;
using System.Net.WebClient;
namespace ConsoleApplication
{
public class Program
{
public static void Main(string[] args)
{
using (var webClient = new WebClient())
{
var url = [someurl];
var htmlCode = webClient.DownloadData(url);
var base64 = Convert.ToBase64String(htmlCode);
}
}
}
}
注:
$ dotnet --version
1.0.0-preview2-1-003175
は、私は、Visualコードで作成され、簡単なWebクライアントの例を実行しようとしています3210文一つ一つ、この問題に実行している:
{
"version": "1.0.0-*",
"buildOptions": {
"debugType": "portable",
"emitEntryPoint": true
},
"dependencies": {},
"frameworks": {
"netcoreapp1.1": {
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.1.0"
}
},
"imports": "dnxcore50"
}
}
}
これは私の特定に関連している場合、私は理解するのに苦労しています:これは自動的にVSのコードによって生成された、私のproject.json
$ dotnet build
Project cbsearchui_test (.NETCoreApp,Version=v1.1) will be compiled because expected outputs are missing
Compiling test_project for .NETCoreApp,Version=v1.1
/usr/lib64/dotnetcore/dotnet compile-csc
@test_project/obj/Debug/netcoreapp1.1/dotnet-
compile.rsp returned Exit Code 1
test_project/Program.cs(4,18): error CS0234:
The type or namespace name 'WebClient' does not exist in the namespace
'System.Net' (are you missing an assembly reference?)
Compilation failed.
0 Warning(s)
1 Error(s)
Time elapsed 00:00:00.6661503
ですDotnetのインストールおよび/またはFedora 25へのリンク。類似の質問は、compatibility issues、profiling、bad usage statementなどを参照しているようです。
また、netcoreapp
への依存関係を1.1.0ではなくバージョン1.0.0に変更しようとしましたが、同じエラーが引き続き発生します。
私の知る限り、WebClientはバージョン2.0まではdotnet coreには存在しません。 –
https://docs.microsoft.com/en-us/dotnet/api/system.net.webclient?view=netcore-2.0 –
WebClientを使用しないでください。これは廃止されました。 Windows上の.NET FrameworkプロジェクトでもHttpClientに置き換えられました –