Skip to content
Draft
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. See LICENSE in the project root for license information. -->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!--
This file disables telemetry for MakePri.exe to prevent errors related to missing
Microsoft.VisualStudio.Utilities.Internal assembly when updating the Windows App SDK NuGet package.

The error occurs when MakePri.exe tries to use Visual Studio's telemetry functionality but can't
find the Microsoft.VisualStudio.Utilities.Internal assembly. This happens specifically when:
1. Upgrading the Windows App SDK NuGet package to a newer version
2. Building a packaged WinUI3 app

The error appears as:
error MSB6003: The specified task executable "MakePri.exe" could not be run.
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.VisualStudio.Utilities.Internal'

By disabling telemetry, we avoid the need for the missing assembly and allow the build to succeed.
-->
<PropertyGroup>
<!-- Set environment variable to disable telemetry in MakePri.exe -->
<MakePriDisableTelemetry>true</MakePriDisableTelemetry>
<!-- Set as MSBuild property as well in case the tool reads it from there -->
<_MakePriDisableTelemetry>true</_MakePriDisableTelemetry>
</PropertyGroup>

<Target Name="DisableMakePriTelemetry" BeforeTargets="MakePri;GeneratePriFile;_GenerateProjectPriFile">
<PropertyGroup>
<!-- Set environment variable through MSBuild -->
<_MakePriEnvVars>MAKEPRI_DISABLE_TELEMETRY=1;$(_MakePriEnvVars)</_MakePriEnvVars>
</PropertyGroup>

<!-- Add a warning message to inform developers that telemetry has been disabled to prevent errors -->
<Message Text="Windows App SDK: Disabling MakePri.exe telemetry to prevent assembly loading errors during build." Importance="low" />
</Target>
</Project>
14 changes: 14 additions & 0 deletions build/NuSpecs/Microsoft.Build.Msix.Pri/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Microsoft.Build.Msix.Pri Telemetry Disabler

This directory contains targets files to disable telemetry for MakePri.exe during Windows App SDK package builds.

## DisableTelemetry.targets

This file sets environment variables and MSBuild properties to disable telemetry in MakePri.exe, preventing errors related to missing Microsoft.VisualStudio.Utilities.Internal assembly when updating the Windows App SDK NuGet package.

The issue occurs when MakePri.exe attempts to use Visual Studio's telemetry functionality but can't find the required assembly, causing the build to fail with:
```
error MSB6003: The specified task executable "MakePri.exe" could not be run. System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.VisualStudio.Utilities.Internal, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
```

This targets file provides a solution by disabling the telemetry feature in MakePri.exe, allowing the build to proceed without requiring the missing assembly.
3 changes: 3 additions & 0 deletions build/NuSpecs/Microsoft.WindowsAppSDK.Foundation.targets
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
<!-- Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. See LICENSE in the project root for license information. -->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<!-- Import the targets file that disables telemetry for MakePri.exe -->
<Import Project="$(MSBuildThisFileDirectory)Microsoft.Build.Msix.Pri\Microsoft.Build.Msix.Pri.DisableTelemetry.targets" />

<Import Project="$(MSBuildThisFileDirectory)Microsoft.WindowsAppSDK.BootstrapCommon.targets" />
<Import Project="$(MSBuildThisFileDirectory)Microsoft.WindowsAppSDK.Bootstrap.CS.targets" Condition="'$(WindowsAppSdkBootstrapInitialize)' == 'true'"/>

Expand Down
3 changes: 3 additions & 0 deletions build/NuSpecs/WindowsAppSDK-Nuget-Native.targets
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
<!-- Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. See LICENSE in the project root for license information. -->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<!-- Import the targets file that disables telemetry for MakePri.exe -->
<Import Project="$(MSBuildThisFileDirectory)Microsoft.Build.Msix.Pri\Microsoft.Build.Msix.Pri.DisableTelemetry.targets" />

<PropertyGroup>
<Native-Platform Condition="'$(Platform)' == 'Win32'">x86</Native-Platform>
<Native-Platform Condition="'$(Platform)' != 'Win32'">$(Platform)</Native-Platform>
Expand Down