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

Only Include Arch-Specific DLLs for RID-Specific Builds That Reference TraceEvent #1845

Merged

Conversation

brianrob
Copy link
Member

Today when a RID-specific build of TraceEvent is done, all of the native DLLs for all architectures are included in the output. This means that there are several DLLs that are never needed. Worse, in the case of single-file builds, those DLLs are included in the final image, which results in a larger binary with no benefit.

Change the behavior so that when a RID-specific build is done, only the needed native DLLs are included.

@@ -1,77 +1,77 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<None Condition="Exists('$(MSBuildThisFileDirectory)..\build\native\x86\KernelTraceControl.dll')" Include="$(MSBuildThisFileDirectory)..\build\native\x86\KernelTraceControl.dll">
<None Condition="Exists('$(MSBuildThisFileDirectory)..\build\native\x86\KernelTraceControl.dll') And ('$(ProcessorArchitecture)' == 'x86' Or '$(ProcessorArchitecture)' == 'msil')" Include="$(MSBuildThisFileDirectory)..\build\native\x86\KernelTraceControl.dll">
Copy link
Member

Choose a reason for hiding this comment

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

I was a bit worried because the transformations from RID to ProcessorArchitecture happen in .targets, but this is in an item, so it's processed later despite being imported earlier. These conditions wouldn't work in a PropertyGroup but they're fine here.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks. That's not something that I was aware of.

@brianrob brianrob merged commit d624a14 into microsoft:main Mar 28, 2023
@brianrob brianrob deleted the dev/brianrob/arch-specific-native-dlls branch March 28, 2023 21:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants