C
C#2y ago
skyrbunny

❔ System.Net.HTTP missing

Hey there, I'm writing something that needs HTTP requests, but when I try to use it, it says System.Net doesn't have the namespace: The type or namespace name 'Http' does not exist in the namespace 'System.Net' (are you missing an assembly reference?) [CSharpDll]csharp(CS0234) Is there a certain platform or version I need to target to get it to work? My CSProj begins like <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">, and I need to keep it like that. Do I have to find a workaround?
46 Replies
Angius
Angius2y ago
This looks like the old project style? What's the .NET version you're using?
skyrbunny
skyrbunnyOP2y ago
Latest but it's based on a template from the web er, 7.something
jcotton42
jcotton422y ago
Show the whole csproj
Pobiega
Pobiega2y ago
that is a .net framework, old-style project file <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
Angius
Angius2y ago
It's an old version of an old version of .NET It's old squared, there's no System.Net.Http
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
skyrbunny
skyrbunnyOP2y ago
so what should I do instead
MODiX
MODiX2y ago
tebeco#0205
<Reference Include="System.Net.Http" />
Quoted by
<@!85903769203642368> from #System.Net.HTTP missing (click here)
React with ❌ to remove this embed.
Angius
Angius2y ago
Try this
skyrbunny
skyrbunnyOP2y ago
The primary reference "System.Net.Http", which is a framework assembly, could not be resolved in the currently targeted framework. ".NETFramework,Version=v4.0". To resolve this problem, either remove the reference "System.Net.Http" or retarget your application to a framework version which contains "System.Net.Http". darn. I guess I'm out of luck The app I'm making a plugin for says If using C# or VB.NET, you need to target .NET 4.0 client profile and for all interfaces note that MusicBee runs in 32-bit mode on 64-bit machines
leowest
leowest2y ago
You can use HttpWebRequest which exists in .net fx 4 and if the request u need to make is simple enough u could even use webclient that is assuming you are not able to bring in the System.Net.Http dll with your project if u can u could install it using nuget
skyrbunny
skyrbunnyOP2y ago
I just need to get the html from a web page
Angius
Angius2y ago
Try using a WebClient maybe? Instead of the modern and proper HttpClient
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
skyrbunny
skyrbunnyOP2y ago
i have to use it, musicbee is on .net 4
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
skyrbunny
skyrbunnyOP2y ago
yeah, a plugin
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
skyrbunny
skyrbunnyOP2y ago
oh, hm
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
skyrbunny
skyrbunnyOP2y ago
i'll ask. What's the latest .NET version? Is it 7?
Pobiega
Pobiega2y ago
yes there was a hard split between 4 and 5 thou, where 5 is based on .NET Core which was a rewrite to make it multi platform we've also dropped the word "Framework" from the name
Henkypenky
Henkypenky2y ago
i just downloaded a plugin and it's in .net fx 4.8
Pobiega
Pobiega2y ago
so .NET Framework 4.8 is a thing, and .NET 7 is a thing
Henkypenky
Henkypenky2y ago
fwiw
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
skyrbunny
skyrbunnyOP2y ago
I'm sorry, all the nomenclatuire for dotnet and core anf c# versions are very confusing to me
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
skyrbunny
skyrbunnyOP2y ago
that's what im quoting here
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
skyrbunny
skyrbunnyOP2y ago
when was System.Net.Http added?
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Henkypenky
Henkypenky2y ago
just a suggestion why not target .net standard and call it a day? 2.0
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Henkypenky
Henkypenky2y ago
i told u i downloaded a plugin and it was 4.8
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Henkypenky
Henkypenky2y ago
ah okay
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Henkypenky
Henkypenky2y ago
leave it here for posterity
skyrbunny
skyrbunnyOP2y ago
i am not going to use a rest api or rewrite the entire api lmao
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Henkypenky
Henkypenky2y ago
yeah, that's probably an insane workaround
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
skyrbunny
skyrbunnyOP2y ago
i was considering using the plugin to host a python/ruby process that would do what I wanted but I want to avoid doing that because it requires too many external dependencies and there's a lot of room for error
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server