Customize the event instrumentation manifest of a “base” project to match the needs of “derived”...












2














I'm working on two different C++ DLL-projects that share most of their code.
So, I have one base project that compiles to Base.lib and two "derived" projects that compile to Derived1.dll and Derived2.dll and link against Base.lib. Those derived DLLs shall be shipped independently. The user does not even know that they are related.



Now I want both of my DLLs to be windows event providers. All events that I want to be logged occur in Base.lib. So, I added an Instrumentation.man to that project and made it part of the build.
Its content looks roughly like this:



<?xml version="1.0" encoding="UTF-16"?>
<instrumentationManifest xsi:schemaLocation="http://schemas.microsoft.com/win/2004/08/events eventman.xsd" xmlns="http://schemas.microsoft.com/win/2004/08/events" xmlns:win="http://manifests.microsoft.com/win/2004/08/windows/events" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:trace="http://schemas.microsoft.com/win/2004/08/events/trace">
<instrumentation>
<events>
<provider name="Company-Provider-Base" guid="{12345678-1234-1234-1234-1234567890ABCD}" symbol="provider" resourceFileName="some/path/to.dll" messageFileName="some/path/to.dll" message="$(string.provider.message)">
<events>
...
</events>
</provider>
</events>
</instrumentation>
<localization>
<resources culture="en-US">
<stringTable>
<string id="provider.message" value="Base Provider" />
...
</stringTable>
</resources>
</localization>
</instrumentationManifest>


I use mc.exe to compile this to a resource file and a header file. The header file is being included by other source files of my Base project.



Now this works surprisingly well! All events are logged properly for both of the DLLs.



However, of course, both DLLs now share the same provider with the same name, guid, and message.



So, my actual question is this:
How can I make the provider element in Instrumentation.man customizable in a way that my DLL-projects can fill in their own name, guid, and message attributes?



I'm using WiX to create my Setup kits. WiX allows me to customize the resourceFileName and messageFileName attributes of the provider element (both point to dummies in the original file) just when the DLLs are deployed on the target system so that they can be referenced properly. However, WIX doesn't offer a similar way (at least I don't see it) to alter the other attributes just as smoothly, which would be exactly what I want.



I also noticed that WiX offers to customize the parameterFileName attribute. Unfortunately, I cannot find any information how these parameters work. I understand that I can put %%n into the strings in the manifest and then the parameter with the identifier n will be inserted. But I don't understand where and how to declare those parameters plus, I don't know if I can use them in the attributes I want to customize so that they wouldn't help me at all.










share|improve this question





























    2














    I'm working on two different C++ DLL-projects that share most of their code.
    So, I have one base project that compiles to Base.lib and two "derived" projects that compile to Derived1.dll and Derived2.dll and link against Base.lib. Those derived DLLs shall be shipped independently. The user does not even know that they are related.



    Now I want both of my DLLs to be windows event providers. All events that I want to be logged occur in Base.lib. So, I added an Instrumentation.man to that project and made it part of the build.
    Its content looks roughly like this:



    <?xml version="1.0" encoding="UTF-16"?>
    <instrumentationManifest xsi:schemaLocation="http://schemas.microsoft.com/win/2004/08/events eventman.xsd" xmlns="http://schemas.microsoft.com/win/2004/08/events" xmlns:win="http://manifests.microsoft.com/win/2004/08/windows/events" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:trace="http://schemas.microsoft.com/win/2004/08/events/trace">
    <instrumentation>
    <events>
    <provider name="Company-Provider-Base" guid="{12345678-1234-1234-1234-1234567890ABCD}" symbol="provider" resourceFileName="some/path/to.dll" messageFileName="some/path/to.dll" message="$(string.provider.message)">
    <events>
    ...
    </events>
    </provider>
    </events>
    </instrumentation>
    <localization>
    <resources culture="en-US">
    <stringTable>
    <string id="provider.message" value="Base Provider" />
    ...
    </stringTable>
    </resources>
    </localization>
    </instrumentationManifest>


    I use mc.exe to compile this to a resource file and a header file. The header file is being included by other source files of my Base project.



    Now this works surprisingly well! All events are logged properly for both of the DLLs.



    However, of course, both DLLs now share the same provider with the same name, guid, and message.



    So, my actual question is this:
    How can I make the provider element in Instrumentation.man customizable in a way that my DLL-projects can fill in their own name, guid, and message attributes?



    I'm using WiX to create my Setup kits. WiX allows me to customize the resourceFileName and messageFileName attributes of the provider element (both point to dummies in the original file) just when the DLLs are deployed on the target system so that they can be referenced properly. However, WIX doesn't offer a similar way (at least I don't see it) to alter the other attributes just as smoothly, which would be exactly what I want.



    I also noticed that WiX offers to customize the parameterFileName attribute. Unfortunately, I cannot find any information how these parameters work. I understand that I can put %%n into the strings in the manifest and then the parameter with the identifier n will be inserted. But I don't understand where and how to declare those parameters plus, I don't know if I can use them in the attributes I want to customize so that they wouldn't help me at all.










    share|improve this question



























      2












      2








      2







      I'm working on two different C++ DLL-projects that share most of their code.
      So, I have one base project that compiles to Base.lib and two "derived" projects that compile to Derived1.dll and Derived2.dll and link against Base.lib. Those derived DLLs shall be shipped independently. The user does not even know that they are related.



      Now I want both of my DLLs to be windows event providers. All events that I want to be logged occur in Base.lib. So, I added an Instrumentation.man to that project and made it part of the build.
      Its content looks roughly like this:



      <?xml version="1.0" encoding="UTF-16"?>
      <instrumentationManifest xsi:schemaLocation="http://schemas.microsoft.com/win/2004/08/events eventman.xsd" xmlns="http://schemas.microsoft.com/win/2004/08/events" xmlns:win="http://manifests.microsoft.com/win/2004/08/windows/events" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:trace="http://schemas.microsoft.com/win/2004/08/events/trace">
      <instrumentation>
      <events>
      <provider name="Company-Provider-Base" guid="{12345678-1234-1234-1234-1234567890ABCD}" symbol="provider" resourceFileName="some/path/to.dll" messageFileName="some/path/to.dll" message="$(string.provider.message)">
      <events>
      ...
      </events>
      </provider>
      </events>
      </instrumentation>
      <localization>
      <resources culture="en-US">
      <stringTable>
      <string id="provider.message" value="Base Provider" />
      ...
      </stringTable>
      </resources>
      </localization>
      </instrumentationManifest>


      I use mc.exe to compile this to a resource file and a header file. The header file is being included by other source files of my Base project.



      Now this works surprisingly well! All events are logged properly for both of the DLLs.



      However, of course, both DLLs now share the same provider with the same name, guid, and message.



      So, my actual question is this:
      How can I make the provider element in Instrumentation.man customizable in a way that my DLL-projects can fill in their own name, guid, and message attributes?



      I'm using WiX to create my Setup kits. WiX allows me to customize the resourceFileName and messageFileName attributes of the provider element (both point to dummies in the original file) just when the DLLs are deployed on the target system so that they can be referenced properly. However, WIX doesn't offer a similar way (at least I don't see it) to alter the other attributes just as smoothly, which would be exactly what I want.



      I also noticed that WiX offers to customize the parameterFileName attribute. Unfortunately, I cannot find any information how these parameters work. I understand that I can put %%n into the strings in the manifest and then the parameter with the identifier n will be inserted. But I don't understand where and how to declare those parameters plus, I don't know if I can use them in the attributes I want to customize so that they wouldn't help me at all.










      share|improve this question















      I'm working on two different C++ DLL-projects that share most of their code.
      So, I have one base project that compiles to Base.lib and two "derived" projects that compile to Derived1.dll and Derived2.dll and link against Base.lib. Those derived DLLs shall be shipped independently. The user does not even know that they are related.



      Now I want both of my DLLs to be windows event providers. All events that I want to be logged occur in Base.lib. So, I added an Instrumentation.man to that project and made it part of the build.
      Its content looks roughly like this:



      <?xml version="1.0" encoding="UTF-16"?>
      <instrumentationManifest xsi:schemaLocation="http://schemas.microsoft.com/win/2004/08/events eventman.xsd" xmlns="http://schemas.microsoft.com/win/2004/08/events" xmlns:win="http://manifests.microsoft.com/win/2004/08/windows/events" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:trace="http://schemas.microsoft.com/win/2004/08/events/trace">
      <instrumentation>
      <events>
      <provider name="Company-Provider-Base" guid="{12345678-1234-1234-1234-1234567890ABCD}" symbol="provider" resourceFileName="some/path/to.dll" messageFileName="some/path/to.dll" message="$(string.provider.message)">
      <events>
      ...
      </events>
      </provider>
      </events>
      </instrumentation>
      <localization>
      <resources culture="en-US">
      <stringTable>
      <string id="provider.message" value="Base Provider" />
      ...
      </stringTable>
      </resources>
      </localization>
      </instrumentationManifest>


      I use mc.exe to compile this to a resource file and a header file. The header file is being included by other source files of my Base project.



      Now this works surprisingly well! All events are logged properly for both of the DLLs.



      However, of course, both DLLs now share the same provider with the same name, guid, and message.



      So, my actual question is this:
      How can I make the provider element in Instrumentation.man customizable in a way that my DLL-projects can fill in their own name, guid, and message attributes?



      I'm using WiX to create my Setup kits. WiX allows me to customize the resourceFileName and messageFileName attributes of the provider element (both point to dummies in the original file) just when the DLLs are deployed on the target system so that they can be referenced properly. However, WIX doesn't offer a similar way (at least I don't see it) to alter the other attributes just as smoothly, which would be exactly what I want.



      I also noticed that WiX offers to customize the parameterFileName attribute. Unfortunately, I cannot find any information how these parameters work. I understand that I can put %%n into the strings in the manifest and then the parameter with the identifier n will be inserted. But I don't understand where and how to declare those parameters plus, I don't know if I can use them in the attributes I want to customize so that they wouldn't help me at all.







      c++ visual-studio wix instrumentation etw






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 20 at 14:50

























      asked Nov 20 at 13:44









      sebrockm

      722112




      722112
























          1 Answer
          1






          active

          oldest

          votes


















          0














          I ended up writing my own XML modification tool (in C# as described here, but any other language will do, too) that takes the manifest file and the solution name and replaces the attribute values accordingly.



          To make this work automatically, I added a Pre-Build Event to the Base project that calls this tool and passes it the manifest file and the $(SolutionName).



          This solution is neither pretty nor easily scalable, but it works.






          share|improve this answer





















            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53394401%2fcustomize-the-event-instrumentation-manifest-of-a-base-project-to-match-the-ne%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            I ended up writing my own XML modification tool (in C# as described here, but any other language will do, too) that takes the manifest file and the solution name and replaces the attribute values accordingly.



            To make this work automatically, I added a Pre-Build Event to the Base project that calls this tool and passes it the manifest file and the $(SolutionName).



            This solution is neither pretty nor easily scalable, but it works.






            share|improve this answer


























              0














              I ended up writing my own XML modification tool (in C# as described here, but any other language will do, too) that takes the manifest file and the solution name and replaces the attribute values accordingly.



              To make this work automatically, I added a Pre-Build Event to the Base project that calls this tool and passes it the manifest file and the $(SolutionName).



              This solution is neither pretty nor easily scalable, but it works.






              share|improve this answer
























                0












                0








                0






                I ended up writing my own XML modification tool (in C# as described here, but any other language will do, too) that takes the manifest file and the solution name and replaces the attribute values accordingly.



                To make this work automatically, I added a Pre-Build Event to the Base project that calls this tool and passes it the manifest file and the $(SolutionName).



                This solution is neither pretty nor easily scalable, but it works.






                share|improve this answer












                I ended up writing my own XML modification tool (in C# as described here, but any other language will do, too) that takes the manifest file and the solution name and replaces the attribute values accordingly.



                To make this work automatically, I added a Pre-Build Event to the Base project that calls this tool and passes it the manifest file and the $(SolutionName).



                This solution is neither pretty nor easily scalable, but it works.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Dec 7 at 11:21









                sebrockm

                722112




                722112






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.





                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                    Please pay close attention to the following guidance:


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53394401%2fcustomize-the-event-instrumentation-manifest-of-a-base-project-to-match-the-ne%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Costa Masnaga

                    Fotorealismo

                    Sidney Franklin