Customize the event instrumentation manifest of a “base” project to match the needs of “derived”...
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
add a comment |
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
add a comment |
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
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
c++ visual-studio wix instrumentation etw
edited Nov 20 at 14:50
asked Nov 20 at 13:44
sebrockm
722112
722112
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
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.
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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.
add a comment |
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.
add a comment |
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.
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.
answered Dec 7 at 11:21
sebrockm
722112
722112
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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