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

vcmeta.dll and incremental builds in .NET MAUI projects #3128

Closed
jonathanpeppers opened this issue Nov 10, 2022 · 5 comments
Closed

vcmeta.dll and incremental builds in .NET MAUI projects #3128

jonathanpeppers opened this issue Nov 10, 2022 · 5 comments
Assignees
Labels
area-Infrastructure Build, test, source layout, package construction (TODO: move to Deployment, DeveloperTools) bug Something isn't working team-Markup

Comments

@jonathanpeppers
Copy link
Member

This is somewhat related to this older issue.

We found installing the .NET MAUI workload in Visual Studio, incremental builds always hit time spent in:

image

But if you install this workload:

image

Then the problem goes away:

image

Debugging what is happening, I found the presence of:

VCInstallPath32 = C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.34.31933\bin\HostX64\x86\vcmeta.dll
VCInstallPath64 = C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.34.31933\bin\HostX64\x64\vcmeta.dll

When these exist, incremental builds are able to skip extra work. When they are missing, you see:

Xaml Compiler Marker: 2:31:45 PM: 887 perfXC_FingerprintCheck, Local Assembly FingerPrint Changed
Xaml Compiler Marker: 2:31:45 PM: 887 perfXC_FingerprintCheck, Reference Assemblies Fingerprint Changed

Ask: Can we avoid vcmeta.dll usage? or ship this file as part of the Windows App SDK?

Details on how we are addressing this for now here. It unfortunately will add ~290MB to .NET MAUI's install footprint.

@mattleibow
Copy link

Is it possible to add the (hopefully) few bits to the https://www.nuget.org/packages/Microsoft.Windows.SDK.BuildTools NuGet so dotnet build also works well when there is no VS installed?

BuildTools is great because it allows for a much smaller dev install and also removes the requirement of VS to build on CI.

@mattleibow
Copy link

I see in the WASDK targets Microsoft.UI.Xaml.Markup.Compiler.interop.targets:

    <Target Name="GetVCInstallPath" Condition="'$(VCInstallPath32)' == '' and '$(VCInstallPath64)' == ''">
      <GetLatestMSVCVersion MSVCDirectoryPath="$(VsInstallRoot)\VC\Tools\MSVC" Condition="'$(VCToolsInstallDir)' == '' and '$(VsInstallRoot)' != ''">
        <Output TaskParameter="LatestMSVCVersion" PropertyName="LatestMSVCVersion"/>
      </GetLatestMSVCVersion>
      <PropertyGroup Condition="'$(VCToolsInstallDir)' == '' and '$(VsInstallRoot)' != ''">
        <VCToolsInstallDir Condition="'$(VCToolsInstallDir)' == ''">$(VsInstallRoot)\VC\Tools\MSVC\$(LatestMSVCVersion)\</VCToolsInstallDir>
      </PropertyGroup>
      <PropertyGroup Condition="'$(VCToolsInstallDir)' != ''">
        <_VCInstallPathHostArchitecture Condition="'$(PROCESSOR_ARCHITECTURE)' == 'x86'">X86</_VCInstallPathHostArchitecture>
        <_VCInstallPathHostArchitecture Condition="'$(PROCESSOR_ARCHITECTURE)' != 'x86'">X64</_VCInstallPathHostArchitecture>
        <VCInstallPath32>$(VCToolsInstallDir)bin\Host$(_VCInstallPathHostArchitecture)\x86\vcmeta.dll</VCInstallPath32>
        <VCInstallPath64>$(VCToolsInstallDir)bin\Host$(_VCInstallPathHostArchitecture)\x64\vcmeta.dll</VCInstallPath64>
      </PropertyGroup>
    </Target>

Looking at this, it appears if the BuildTools NuGet could set the $(VCInstallPath32) and $(VCInstallPath64) paths, then this should be skipped?

@mattleibow
Copy link

Looking at the binlog for dotnet build, it does not actually follow the same path:

Task "CompileXaml" skipped, due to false condition; ('$(UseXamlCompilerExecutable)' != 'true') was evaluated as ('true' != 'true').

Instead it uses an executable - but that also takes a long time:

Exec = 4.7s
    Assembly = Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
    Parameters
        Command = "C:\Users\mattl\.nuget\packages\microsoft.windowsappsdk\1.1.5\buildTransitive\..\tools\net5.0\..\net472\XamlCompiler.exe" "obj\Debug\net7.0-windows10.0.19041.0\win10-x64\\input.json" "obj\Debug\net7.0-windows10.0.19041.0\win10-x64\\output.json"
    CommandLineArguments = "C:\Users\mattl\.nuget\packages\microsoft.windowsappsdk\1.1.5\buildTransitive\..\tools\net5.0\..\net472\XamlCompiler.exe" "obj\Debug\net7.0-windows10.0.19041.0\win10-x64\\input.json" "obj\Debug\net7.0-windows10.0.19041.0\win10-x64\\output.json"

@evelynwu-msft
Copy link
Contributor

Tagging @mikebattista to comment on the feasibility of adding vcmeta.dll (from VC++ tools) to the Microsoft.Windows.SDK.BuildTools Nuget package; WinUI uses one of its exported functions to compare two assemblies/winmds and determine whether or not they have the same public APi surface.

@gabbybilka gabbybilka added bug Something isn't working area-Infrastructure Build, test, source layout, package construction (TODO: move to Deployment, DeveloperTools) team-Markup labels Nov 17, 2022
@jonathanpeppers
Copy link
Member Author

This is completed by: https://microsoft.visualstudio.com/WinUI/_git/microsoft-ui-xaml-lift/pullrequest/8128511

We ported vcmeta.dll usage to C# using System.Reflection.Metadata.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Infrastructure Build, test, source layout, package construction (TODO: move to Deployment, DeveloperTools) bug Something isn't working team-Markup
Projects
None yet
Development

No branches or pull requests

4 participants