Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build TraceEvent NuGet package #229

Merged
merged 5 commits into from
May 30, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,4 @@ cache:
artifacts:
- path: 'src\PerfView\bin\$(configuration)\PerfView.exe'
- path: 'src\PerfView64\bin\$(configuration)\PerfView64.exe'
- path: 'src\TraceEvent\bin\$(configuration)\*.nupkg'
49 changes: 49 additions & 0 deletions src/TraceEvent/Microsoft.Diagnostics.Tracing.TraceEvent.nuspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?xml version="1.0"?>
<package>
<metadata minClientVersion="2.5">
<id>Microsoft.Diagnostics.Tracing.TraceEvent</id>
<version>0.0.0</version>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 This along with $version$ are automatically populated from the [AssemblyInformationalVersion] attribute value.

<title>Microsoft TraceEvent Library</title>
<authors>Microsoft</authors>
<owners>Microsoft</owners>
<licenseUrl>http://go.microsoft.com/fwlink/?LinkId=329770</licenseUrl>
<iconUrl>http://go.microsoft.com/fwlink/?LinkID=288859</iconUrl>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<description>
Event Tracing for Windows (ETW) is a powerful logging mechanism built into the Windows OS and is used extensively in Windows. You can also log ETW events yourself code using the System.Diagnostics.Tracing.EventSource class.

The TraceEvent library conains the classes needed to control ETW providers (including EventSources) and parse the events they emit.

The library includes
-- TraceEventSession which can enable ETW providers,
-- EtwTraceEventSource which lets you read the stream of ETW events, and
-- TraceLog which is is digested form of ETW events which include decoded stack traces associated with the events.

Also see the TraceEvent Samples NuGet package for example uses of this library.
</description>
<summary>TraceEvent is a .NET Framework library for capturing and analyzing ETW events.</summary>
<releaseNotes>https://github.com/Microsoft/perfview/releases/tag/V$version$</releaseNotes>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 This link is much more maintainable than the previous approach.

<copyright>Copyright © Microsoft Corporation</copyright>
<tags>TraceEvent EvenSource Microsoft ETW Event Tracing for Windows</tags>
</metadata>

<files>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 I intentionally left out the content files which are part of the current NuGet package. This is not a standard convention for NuGet packages and despite the intention makes it harder to adopt the package in a project.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused by this statement. content is a NuGet standard: https://docs.microsoft.com/en-us/nuget/schema/nuspec#including-content-files

It's a confusing standard that has changed behavior over time, which is probably enough to avoid using it though.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rainersigwald What I mean is, the TraceEvent NuGet package currently adds its readme and getting started guide to the project whenever you install it into a project. This is allowed, but makes installing the package more burdensome when you have to go delete these files every time.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree we should not put docs in the package. All of that predated GitHub and easy web links. We have wanted to get rid of it for a while.

<!-- Support for native binaries -->
<file src="Microsoft.Diagnostics.Tracing.TraceEvent.props" target="build\Microsoft.Diagnostics.Tracing.TraceEvent.props" />

<!-- Native binaries -->
<file src="$OutDir$amd64\KernelTraceControl.dll" target="lib\native\amd64\KernelTraceControl.dll" />
<file src="$OutDir$amd64\msdia140.dll" target="lib\native\amd64\msdia140.dll" />
<file src="$OutDir$x86\KernelTraceControl.dll" target="lib\native\x86\KernelTraceControl.dll" />
<file src="$OutDir$x86\KernelTraceControl.Win61.dll" target="lib\native\x86\KernelTraceControl.Win61.dll" />
<file src="$OutDir$x86\msdia140.dll" target="lib\native\x86\msdia140.dll" />

<!-- Libraries and sources -->
<file src="$OutDir$Microsoft.Diagnostics.Tracing.TraceEvent.dll" target="lib\net45" />
<file src="$OutDir$Microsoft.Diagnostics.Tracing.TraceEvent.xml" target="lib\net45" />
<file src="$OutDir$Microsoft.Diagnostics.Tracing.TraceEvent.pdb" target="lib\net45" />
<file exclude="obj\**\*.cs" src="**\*.cs" target="src" />
<file src="obj\$Configuration$\**\*.cs" target="src\obj\$Configuration$" />
</files>

</package>
30 changes: 30 additions & 0 deletions src/TraceEvent/Microsoft.Diagnostics.Tracing.TraceEvent.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<None Condition="Exists('$(MSBuildThisFileDirectory)..\lib\native\x86\KernelTraceControl.dll')" Include="$(MSBuildThisFileDirectory)..\lib\native\x86\KernelTraceControl.dll">
<Link>x86\KernelTraceControl.dll</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Visible>False</Visible>
</None>
<None Condition="Exists('$(MSBuildThisFileDirectory)..\lib\native\x86\KernelTraceControl.Win61.dll')" Include="$(MSBuildThisFileDirectory)..\lib\native\x86\KernelTraceControl.Win61.dll">
<Link>x86\KernelTraceControl.Win61.dll</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Visible>False</Visible>
</None>
<None Condition="Exists('$(MSBuildThisFileDirectory)..\lib\native\x86\msdia140.dll')" Include="$(MSBuildThisFileDirectory)..\lib\native\x86\msdia140.dll">
<Link>x86\msdia140.dll</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Visible>False</Visible>
</None>
<None Condition="Exists('$(MSBuildThisFileDirectory)..\lib\native\amd64\KernelTraceControl.dll')" Include="$(MSBuildThisFileDirectory)..\lib\native\amd64\KernelTraceControl.dll">
<Link>amd64\KernelTraceControl.dll</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Visible>False</Visible>
</None>
<None Condition="Exists('$(MSBuildThisFileDirectory)..\lib\native\amd64\msdia140.dll')" Include="$(MSBuildThisFileDirectory)..\lib\native\amd64\msdia140.dll">
<Link>amd64\msdia140.dll</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Visible>False</Visible>
</None>
</ItemGroup>
</Project>
4 changes: 4 additions & 0 deletions src/TraceEvent/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,8 @@
[assembly: NeutralResourcesLanguage("en")]

// [assembly: InternalsVisibleTo("PerfView")]
[assembly: AssemblyVersion("1.0.42.0")]
Copy link
Member Author

@sharwell sharwell May 21, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 There are multiple approaches available which either eliminate the need to manually update these, or dramatically reduce the frequency of changes. If you describe your desired versioning behavior either @AArnott or myself will implement that approach as described or will propose changes in order to make things even simpler. If you are unsure of what you want, we can make recommendations.

This applies to the TraceEvent library along with each of the other assemblies build by this solution for distribution.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to follow the simplest/most commonly used approach (to NOT be innovative). Ideally humans don't deal with version numbers much at all (only on major transitions).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. Which is exactly why a couple groups of people developed a NuGet package to establish a simple pattern you can follow and then basically forget about versioning except when you really want to bump the major (or minor) versions.
Check out Nerdbank.GitVersioning. Disclosure: I wrote it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vancem From what you have said, my versioning approaches target a different audience and are not likely what you want to deal with. My recommendation is to let @AArnott file a pull request later after this one is completed and merged which incorporates his versioning tools. They are as low maintenance as you can get.

[assembly: AssemblyFileVersion("1.0.42")]
[assembly: AssemblyInformationalVersion("1.0.42-dev")]

[assembly: InternalsVisibleTo("TraceEventTests")]
35 changes: 35 additions & 0 deletions src/TraceEvent/TraceEvent.csproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\packages\Tvl.NuGet.BuildTasks.1.0.0-alpha002\build\Tvl.NuGet.BuildTasks.props" Condition="Exists('..\..\packages\Tvl.NuGet.BuildTasks.1.0.0-alpha002\build\Tvl.NuGet.BuildTasks.props')" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this for? Presumably it is a Nuget building thing?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's added by a package that tells MSBuild how to convert the .nuspec into a .nupkg as part of the build. The source is here:

https://github.com/tunnelvisionlabs/NuGetBuildTasks

<Import Project="..\..\packages\Microsoft.Diagnostics.Tracing.TraceEvent.SupportFiles.1.0.2\build\Microsoft.Diagnostics.Tracing.TraceEvent.SupportFiles.props" Condition="Exists('..\..\packages\Microsoft.Diagnostics.Tracing.TraceEvent.SupportFiles.1.0.2\build\Microsoft.Diagnostics.Tracing.TraceEvent.SupportFiles.props')" />
<PropertyGroup>
<PerfLibRootPath>$(MSBuildThisFileDirectory)\..</PerfLibRootPath>
Expand Down Expand Up @@ -161,6 +162,37 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<NuGetManifest Include="Microsoft.Diagnostics.Tracing.TraceEvent.nuspec">
<Symbols>true</Symbols>
</NuGetManifest>
</ItemGroup>
<ItemGroup>
<None Include="$(TraceEventSupportFilesBase)native\amd64\KernelTraceControl.dll">
<Link>amd64\KernelTraceControl.dll</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Visible>False</Visible>
</None>
<None Include="$(TraceEventSupportFilesBase)native\amd64\msdia140.dll">
<Link>amd64\msdia140.dll</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Visible>False</Visible>
</None>
<None Include="$(TraceEventSupportFilesBase)native\x86\KernelTraceControl.dll">
<Link>x86\KernelTraceControl.dll</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Visible>False</Visible>
</None>
<None Include="$(TraceEventSupportFilesBase)native\x86\KernelTraceControl.Win61.dll">
<Link>x86\KernelTraceControl.Win61.dll</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Visible>False</Visible>
</None>
<None Include="$(TraceEventSupportFilesBase)native\x86\msdia140.dll">
<Link>x86\msdia140.dll</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Visible>False</Visible>
</None>
<None Include="Microsoft.Diagnostics.Tracing.TraceEvent.props" />
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(PerfLibRootPath)\PerfLib.targets" />
Expand All @@ -169,5 +201,8 @@
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\packages\Microsoft.Diagnostics.Tracing.TraceEvent.SupportFiles.1.0.2\build\Microsoft.Diagnostics.Tracing.TraceEvent.SupportFiles.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Diagnostics.Tracing.TraceEvent.SupportFiles.1.0.2\build\Microsoft.Diagnostics.Tracing.TraceEvent.SupportFiles.props'))" />
<Error Condition="!Exists('..\..\packages\Tvl.NuGet.BuildTasks.1.0.0-alpha002\build\Tvl.NuGet.BuildTasks.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Tvl.NuGet.BuildTasks.1.0.0-alpha002\build\Tvl.NuGet.BuildTasks.props'))" />
<Error Condition="!Exists('..\..\packages\Tvl.NuGet.BuildTasks.1.0.0-alpha002\build\Tvl.NuGet.BuildTasks.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Tvl.NuGet.BuildTasks.1.0.0-alpha002\build\Tvl.NuGet.BuildTasks.targets'))" />
</Target>
<Import Project="..\..\packages\Tvl.NuGet.BuildTasks.1.0.0-alpha002\build\Tvl.NuGet.BuildTasks.targets" Condition="Exists('..\..\packages\Tvl.NuGet.BuildTasks.1.0.0-alpha002\build\Tvl.NuGet.BuildTasks.targets')" />
</Project>
2 changes: 2 additions & 0 deletions src/TraceEvent/packages.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Diagnostics.Tracing.TraceEvent.SupportFiles" version="1.0.2" targetFramework="net45" />
<package id="NuGet.CommandLine" version="2.8.3" targetFramework="net45" />
<package id="Tvl.NuGet.BuildTasks" version="1.0.0-alpha002" targetFramework="net45" developmentDependency="true" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could also use NuGetizer-3000 for this for a "more supported" approach: https://github.com/NuGet/NuGet.Build.Packaging.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have particular experience with that one, but I've been quite happy with the performance of these build tasks for cases where one NuGet package is created for the assembly contained in one C# project.

</packages>