Inedo Community Forums Forums
    • Recent
    • Tags
    • Popular
    • Login

    Welcome to the Inedo Forums! Check out the Forums Guide for help getting started.

    If you are experiencing any issues with the forum software, please visit the Contact Form on our website and let us know!

    How to add ProGetAssemblyAttribute to an extension?

    Scheduled Pinned Locked Moved Support
    proget
    8 Posts 1 Posters 3 Views
    Loading More Posts
    • 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.
    • ? This user is from outside of this forum
      Guest
      last edited by

      Hi,

      I'm trying to get an AfterPush Package Adapter running. I've created a MyExtension class, inherited from AfterPushPackageAdapterBase. The class has the ProGetComponentProperties attribute and I also added the following line to AssemblyInfo.cs:

      [assembly: ProGetAssembly]

      The class overrides the Adapt method since I guess, that's the entrypoint for the extension. I pack everything in a zip, rename it to MyExtension.progetx and push it into the configured extensions folder on the proget server. When I restart the service, I get the following error:

      One or more errors occurred while loading this extension.
      
      Assembly MyExtension, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
      is missing the required attribute ProGetAssemblyAttribute.
      

      Did I miss something? Is there a sample for an AfterPush Adapter. Since it's only a few lines of code (i guess), it would be really cool if you could provide these kind of samples to the world. Would be really really helpful since the ProGet SDK Documentation is more a listing of class- and method names but not really a documentation.

      Best Regards,

      Joachim

      Product: ProGet
      Version: 3.8.6

      1 Reply Last reply Reply Quote 0
      • ? This user is from outside of this forum
        Guest
        last edited by

        Ok, got the problem with the Attribute. I've used the ProGet SDK from nuget.org and that seems to be outdated. I removed it and used the appropriate DLLs from my actual ProGet installation and the Extensions is recognized without an error.

        But! i still get nothing working my Extension looks like that:

        public class MyExtension : AfterPushPackageAdapterBase
        {
            public override PackageContainer Adapt(PackageContainer item)
            {
                File.WriteAllText(@"C:\testout.txt", item.Metadata.Id + " - " + item.Metadata.Version.OriginalString);
                return item;
            }
            
        }
        

        I expect to see the testout.txt on c:\ as soon as I upload a nuget package to the server but nothing happens. The package is uploaded but no testout.txt is created :-(

        What's wrong?

        Best Regards,

        Joachim Roppert

        1 Reply Last reply Reply Quote 0
        • ? This user is from outside of this forum
          Guest
          last edited by

          Did you add the adapter configuration XML to the feed? You should be able to set that on the Manage Feed page.

          1 Reply Last reply Reply Quote 0
          • ? This user is from outside of this forum
            Guest
            last edited by

            Yes and it's listed under "Feed Adapters" as "MyExtension (Push)". I test it using the Upload- Button in the Web UI, not a push- Operation using nuget.exe. I assume the upload should also trigger my extension. Right?

            1 Reply Last reply Reply Quote 0
            • ? This user is from outside of this forum
              Guest
              last edited by

              Currently it only works via the /nuget endpoint and not via the web UI. I'll put in a note to add that functionality though - it should work in both cases.

              1 Reply Last reply Reply Quote 0
              • ? This user is from outside of this forum
                Guest
                last edited by

                Hm unfortunately, I tried pushing a package using nuget.exe push but still no sign of life from my extension. Is it correct to simply override the Adapt method or do I have to do something else? Isn't there a working sample available that I can use as a starting point?

                1 Reply Last reply Reply Quote 0
                • ? This user is from outside of this forum
                  Guest
                  last edited by

                  Here is a working sample:

                  http://44.inedo.com/proget/ProGetExtension.zip

                  1 Reply Last reply Reply Quote 0
                  • ? This user is from outside of this forum
                    Guest
                    last edited by

                    Got it working. Thanks, that helps a lot!

                    1 Reply Last reply Reply Quote 0

                    Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                    Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                    With your input, this post could be even better 💗

                    Register Login
                    • 1 / 1
                    • First post
                      Last post
                    Inedo Website Home • Support Home • Code of Conduct • Forums Guide • Documentation