My goal is to embed an instrumentation manifest in a .NET assembly. To do that, I compile the manifest file (.man) into a resource file (.rc) using mc.exe, then compile the .rc file into a .res file using rc.exe. Finally, I use the Win32Resource element in the .csproj file to embed the .res file into my assembly.
The problem is that once I use the Win32Resource element, I lose the versioning info generated by the AssemblyInfo.cs file.
How can I both embed the instrumentation manifest and keep the versioning info in the resulting assembly?
Please use the Microsoft.Diagnostics.Tracing.EventSource NuGet Package to use ETW in .Net.
Here is a sample class:
[EventSource(Name = "Samples-EventSourceDemos-EventLog")]
public sealed class MinimalEventSource : EventSource
{
public static MinimalEventSource Log = new MinimalEventSource();
[Event(1, Message="{0} -> {1}", Channel = EventChannel.Admin)]
public void Load(long baseAddress, string imageName)
{
WriteEvent(1, baseAddress, imageName);
}
}
This is much better compared to the old C++ way.