❔ iHttpClientFactory in net 461
Having some issues building my project in a Azure DevOps pipeline after I tried to use ihttpclientfactory to deal with socket exhaustion and so on
Getting this lovely message and I can't figure out how to handle it
Package Microsoft.Extensions.Http 3.1.32 is not compatible with net461 (.NETFramework, Version=v4.6.1). Package Microsoft.Extensions. Http 3.1.32 supports:
- netcoreapp3.1 (.NETCoreApp, Version=v3.1) netstandard2.0 (.NETStandard, Version=v2.0)
One or more packages are incompatible with .NETFramework, Version=v4.6.1.)
38 Replies
it actually says all
its not directly compatible but looks like it supports additionally
Do you have this error on local build ?
and can you share your csproj ? where does Azure DevOps resolves nuget dependencies
Oh didn't get a notification
It works fine when building on my local pc
Issue with DevOps is that I have to upload the nuget packages to artifacts first since we're not allowed outside connections to the server
Ah you're thinking I'm missing the standard 2 reference
Which i am
we have similar approach where I work but we have access to nuget.org
so you are copying Microsoft packages from nuget.org to your custom azure feed ?
Yeah I can't access it directly
Have to upload whatever nugets I downloaded locally
Yes
i see
Mhm
The main apps webconfig is targeting 4.5
The class library where I use the httpclientfactory is targeting 4.6.1
do you have following folders in your copied package ?
netstanndard2.0 is compatible with framework 4.6.1
main app might causing the issue
Sorry for the phone camera
Can't have discord on my work laptop
Fuck i hope not
which version of Microsoft.Extensions.Http did you download from nuget.org
I'm an idiot
Sorry hang on
Been a long day
should be the one of netstandard supporting
Project didn't have a netstandard 2 folder
Only after I added the targeted framework and now the project obviously won't build because the main one is 4.5
Great
you can download Microsoft.Extensions.Http 3.1.32 from nuget.org, that one has netstandard support
still main app is 4.5 which makes me uncomfortable
looks like there is no version of Microsoft.Extensions.Http that supports framework 4.5
HM
Managed to get it to accept having netstandard 2.0 in the target framework of the class library
But it's complaining about system.data.sqlclient being gone
Intellisense is of no use
while your class lib supports ns2.0 but referenced package doesn't, it wont compile for ns2.0 output
even if your class lib supports ns2.0, netframework4.5 still not compatible with it
Yeah that makes sense
Bah I am so tired of this project
Can't even upgrade the framework
its pain to work with framework projects, even csproj is pain I feel you
It's not as much trouble when it isn't a decade old
It's all this old outdated crap that I struggle with every day
I started industry with netcore3.1 but work life surely put me into framework projects
Both 461 and webforms
No Oop or EF, just pure sql and triggers
plus work computer and access limitations 🙂
any chance we work in same place ? is it bank ?
Hah yeah
I have to make myself admin and boot VS in admin or I can't even build
Healthcare so nah
nvm
So got any good ideas on some alternative solutions to dealt with httpclient and socket exhaustion and all that
Just say fuck it and do a singleton client?
Not like the DNS for my own api is going to change
I hope
HttpClient is fine most of the time
there should me some configuration for DNS changes
wrap the HttpClient with your custom service that handles conections properly
Not entirely sure what you mean
like create a helper class and create HttpClient instances as static only in that class and use post, get methods
that will be more managble for future if want to upgrade client factory
Hmm
Originally had it in a service that did that and handled the calls
I don't know else alternative, you can create new post for that specifically if someone else has ideas
I don't really see many other options considering I'm locked by frameworks
Oh well thanks for the help!
np, good luck
sorry for the alte reply, IHttpClientFactory is not available in any .net framework version
you need to target .net standard 2.0
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.