Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. NuGet H.E.Double Hockey Sticks

NuGet H.E.Double Hockey Sticks

Scheduled Pinned Locked Moved The Lounge
visual-studioquestioncsharpcloudannouncement
12 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Lost User

    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.

    T Offline
    T Offline
    TNCaver
    wrote on last edited by
    #3

    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.

    L 2 Replies Last reply
    0
    • T TNCaver

      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.

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #4

      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.

      T 1 Reply Last reply
      0
      • T TNCaver

        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.

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #5

        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.

        T 1 Reply Last reply
        0
        • T TNCaver

          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.

          Richard DeemingR Offline
          Richard DeemingR Offline
          Richard Deeming
          wrote on last edited by
          #6

          TNCaver wrote:

          MS extensions dependency injection abstractions package

          Unless you're using the v6 packages, the ServiceCollection class is defined in the Microsoft.Extensions.DependencyInjection package, not the Microsoft.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

          "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

          T 1 Reply Last reply
          0
          • L Lost User

            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.

            T Offline
            T Offline
            TNCaver
            wrote on last edited by
            #7

            I enjoy the ocean, but I prefer mountains, or at least very tall hills and ridges, buried in trees, flowing with rivers to kayak and caves to explore. That's my retirement plans.

            If you think 'goto' is evil, try writing an Assembly program without JMP.

            1 Reply Last reply
            0
            • L Lost User

              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.

              T Offline
              T Offline
              TNCaver
              wrote on last edited by
              #8

              Eddy Vluggen wrote:

              You need a reference to that DLL, as far as I can guess now.

              Yep, or the right DLL, which is another rabbit hole I can't find the bottom of. :sigh:

              If you think 'goto' is evil, try writing an Assembly program without JMP.

              1 Reply Last reply
              0
              • Richard DeemingR Richard Deeming

                TNCaver wrote:

                MS extensions dependency injection abstractions package

                Unless you're using the v6 packages, the ServiceCollection class is defined in the Microsoft.Extensions.DependencyInjection package, not the Microsoft.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

                T Offline
                T Offline
                TNCaver
                wrote on last edited by
                #9

                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.

                Richard DeemingR 1 Reply Last reply
                0
                • T TNCaver

                  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.

                  Richard DeemingR Offline
                  Richard DeemingR Offline
                  Richard Deeming
                  wrote on last edited by
                  #10

                  It will be the right ServiceCollection; it just looks like you're missing some other references.

                  • AddLogging is an extension method defined in the Microsoft.Extensions.Logging NuGet package.
                  • AddApplicationInsightsTelemetryWorkerService is an extension method defined in the Microsoft.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

                  "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

                  T 1 Reply Last reply
                  0
                  • Richard DeemingR Richard Deeming

                    It will be the right ServiceCollection; it just looks like you're missing some other references.

                    • AddLogging is an extension method defined in the Microsoft.Extensions.Logging NuGet package.
                    • AddApplicationInsightsTelemetryWorkerService is an extension method defined in the Microsoft.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

                    T Offline
                    T Offline
                    TNCaver
                    wrote on last edited by
                    #11

                    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 the Microsoft.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.

                    Richard DeemingR 1 Reply Last reply
                    0
                    • T TNCaver

                      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 the Microsoft.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.

                      Richard DeemingR Offline
                      Richard DeemingR Offline
                      Richard Deeming
                      wrote on last edited by
                      #12

                      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 extra using 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

                      "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups