NuGet H.E.Double Hockey Sticks
-
Did you include the assembly as a reference?
TNCaver wrote:
if I retire now, can I live off a reduced SS check and my current 401K and savings for the next 20+ years?
No 401k in Europe. Ask an American.
Bastard Programmer from Hell :suss: "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
It shows up in my references, so I assume it's there. I tried to find it in the Reference Manager to add it manually, just in case, but it isn't there. Not sure that's a problem since it isn't in the Manager in the console app, either, and it works fine. I could retire now if I could talk my wife into moving to Arequipa, Peru. And if we could speak Spanish.
If you think 'goto' is evil, try writing an Assembly program without JMP.
-
It shows up in my references, so I assume it's there. I tried to find it in the Reference Manager to add it manually, just in case, but it isn't there. Not sure that's a problem since it isn't in the Manager in the console app, either, and it works fine. I could retire now if I could talk my wife into moving to Arequipa, Peru. And if we could speak Spanish.
If you think 'goto' is evil, try writing an Assembly program without JMP.
TNCaver wrote:
I could retire now if I could talk my wife into moving to Arequipa, Peru. And if we could speak Spanish.
Then why are we talking references my man? You don't need Spanish in Peru (though it helps).
TNCaver wrote:
It shows up in my references, so I assume it's there. I tried to find it in the Reference Manager to add it manually, just in case, but it isn't there. Not sure that's a problem since it isn't in the Manager in the console app, either, and it works fine.
It was an assumption, sorry.
TNCaver wrote:
I ensure the abstractions DLL shows up in my references, I have a 'using' reference to it, and all that looks good. But VS is telling me the type and namespace can't be found for the ServiceCollection object, although it sees the bloody IServiceCollection interface.
You need a reference to that DLL, as far as I can guess now.
Bastard Programmer from Hell :suss: "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
-
It shows up in my references, so I assume it's there. I tried to find it in the Reference Manager to add it manually, just in case, but it isn't there. Not sure that's a problem since it isn't in the Manager in the console app, either, and it works fine. I could retire now if I could talk my wife into moving to Arequipa, Peru. And if we could speak Spanish.
If you think 'goto' is evil, try writing an Assembly program without JMP.
TNCaver wrote:
I could retire now if I could talk my wife into moving to Arequipa, Peru. And if we could speak Spanish.
Even though I can't, I would given the option. Go live near the coast and be happy?
Bastard Programmer from Hell :suss: "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
-
Sometimes VS and .NET is a PITA. But you know that. I needed to have an Azure web app (Framework 4.7.2) log to app insights, so I installed the various AI packages and MS extensions dependency injection abstractions package. I ensure the abstractions DLL shows up in my references, I have a 'using' reference to it, and all that looks good. But VS is telling me the type and namespace can't be found for the ServiceCollection object, although it sees the bloody IServiceCollection interface. The same packages and the same code works in a console app on the same framework version. So the big question is, if I retire now, can I live off a reduced SS check and my current 401K and savings for the next 20+ years?
If you think 'goto' is evil, try writing an Assembly program without JMP.
TNCaver wrote:
MS extensions dependency injection abstractions package
Unless you're using the v6 packages, the
ServiceCollection
class is defined in theMicrosoft.Extensions.DependencyInjection
package, not theMicrosoft.Extensions.DependencyInjection.Abstractions
package. :) Compare: v5: ServiceCollection Class (Microsoft.Extensions.DependencyInjection) | Microsoft Docs[^] "Assembly: Microsoft.Extensions.DependencyInjection.dll" v6: ServiceCollection Class (Microsoft.Extensions.DependencyInjection) | Microsoft Docs[^] "Assembly: Microsoft.Extensions.DependencyInjection.Abstractions.dll"
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
-
TNCaver wrote:
I could retire now if I could talk my wife into moving to Arequipa, Peru. And if we could speak Spanish.
Even though I can't, I would given the option. Go live near the coast and be happy?
Bastard Programmer from Hell :suss: "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
-
TNCaver wrote:
I could retire now if I could talk my wife into moving to Arequipa, Peru. And if we could speak Spanish.
Then why are we talking references my man? You don't need Spanish in Peru (though it helps).
TNCaver wrote:
It shows up in my references, so I assume it's there. I tried to find it in the Reference Manager to add it manually, just in case, but it isn't there. Not sure that's a problem since it isn't in the Manager in the console app, either, and it works fine.
It was an assumption, sorry.
TNCaver wrote:
I ensure the abstractions DLL shows up in my references, I have a 'using' reference to it, and all that looks good. But VS is telling me the type and namespace can't be found for the ServiceCollection object, although it sees the bloody IServiceCollection interface.
You need a reference to that DLL, as far as I can guess now.
Bastard Programmer from Hell :suss: "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
-
TNCaver wrote:
MS extensions dependency injection abstractions package
Unless you're using the v6 packages, the
ServiceCollection
class is defined in theMicrosoft.Extensions.DependencyInjection
package, not theMicrosoft.Extensions.DependencyInjection.Abstractions
package. :) Compare: v5: ServiceCollection Class (Microsoft.Extensions.DependencyInjection) | Microsoft Docs[^] "Assembly: Microsoft.Extensions.DependencyInjection.dll" v6: ServiceCollection Class (Microsoft.Extensions.DependencyInjection) | Microsoft Docs[^] "Assembly: Microsoft.Extensions.DependencyInjection.Abstractions.dll"
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
Thanks, that got me closer. I removed what I had and installed the Microsoft.Extensions.DependencyInjection package, which also installed the Abstractions package, using the same version as the console app. It now recognizes some version of the ServiceCollection, but not the version with an IServiceCollection that contains the definition for AddLogging and AddApplicationInsightsTelemetryWorkerService. And yet both the web app and console apps are using the same version of those packages, as far as I can tell, and those methods are defined in the console's version. :wtf:
If you think 'goto' is evil, try writing an Assembly program without JMP.
-
Thanks, that got me closer. I removed what I had and installed the Microsoft.Extensions.DependencyInjection package, which also installed the Abstractions package, using the same version as the console app. It now recognizes some version of the ServiceCollection, but not the version with an IServiceCollection that contains the definition for AddLogging and AddApplicationInsightsTelemetryWorkerService. And yet both the web app and console apps are using the same version of those packages, as far as I can tell, and those methods are defined in the console's version. :wtf:
If you think 'goto' is evil, try writing an Assembly program without JMP.
It will be the right
ServiceCollection
; it just looks like you're missing some other references.AddLogging
is an extension method defined in theMicrosoft.Extensions.Logging
NuGet package.AddApplicationInsightsTelemetryWorkerService
is an extension method defined in theMicrosoft.ApplicationInsights.WorkerService
NuGet package.
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
-
It will be the right
ServiceCollection
; it just looks like you're missing some other references.AddLogging
is an extension method defined in theMicrosoft.Extensions.Logging
NuGet package.AddApplicationInsightsTelemetryWorkerService
is an extension method defined in theMicrosoft.ApplicationInsights.WorkerService
NuGet package.
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
Thank you. I owe you a beer. Or three. The question I (and probably you) have now is, why couldn't I find that answer myself? My google-fu is normally black belt level. But you have to admit the situation is complicated, even bizarre.
IServiceCollection
is in theMicrosoft.Extensions.DependencyInjection
namespace, but the methods attached to an object instantiated from that interface are in two other namespaces. I mean, what the actual elephant?If you think 'goto' is evil, try writing an Assembly program without JMP.
-
Thank you. I owe you a beer. Or three. The question I (and probably you) have now is, why couldn't I find that answer myself? My google-fu is normally black belt level. But you have to admit the situation is complicated, even bizarre.
IServiceCollection
is in theMicrosoft.Extensions.DependencyInjection
namespace, but the methods attached to an object instantiated from that interface are in two other namespaces. I mean, what the actual elephant?If you think 'goto' is evil, try writing an Assembly program without JMP.
That part actually makes sense: the extension methods are defined in the assemblies they're used for. Otherwise, all of the classes to configure eg: logging would need to be included in the DI assembly, which would be an absolute mess. :) For the Microsoft extensions I've seen, the class where the extension methods are defined is usually deliberately added to the
Microsoft.Extensions.DependencyInjection
namespace, even though that's not the correct namespace for the assembly. That way, you don't have to add extrausing
statements to your code to configure the services; you just need a reference to the assembly.
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer