mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-02-15 15:49:58 +01:00
<!-- Enter a brief description/summary of your PR here. What does it fix/what does it change/how was it tested (even manually, if necessary)? --> ## Summary of the Pull Request Update project references across multiple projects to utilize `$(RepoRoot)` for paths, ensuring consistency and improving maintainability. <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist - [ ] Closes: N/A - [ ] **Communication:** I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected - [x] **Tests:** Added/updated and all pass - [ ] **Localization:** All end-user-facing strings can be localized - [ ] **Dev docs:** Added/updated - [ ] **New binaries:** Added on the required places - [ ] [JSON for signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json) for new binaries - [ ] [WXS for installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs) for new binaries and localization folder - [ ] [YML for CI pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml) for new test projects - [ ] [YML for signed pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml) - [ ] **Documentation updated:** If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys) and link it here: #xxx <!-- Provide a more detailed description of the PR, other things fixed, or any additional comments/features here --> ## Detailed Description of the Pull Request / Additional comments This change affects the following projects: - `src/common/ManagedCsWin32/ManagedCsWin32.csproj` - `src/common/Common.Search/Common.Search.csproj` - `src/common/AllExperiments/AllExperiments.csproj` - `src/modules/peek/Peek.Common/Peek.Common.csproj` - `src/common/UITestAutomation/UITestAutomation.csproj` - `src/common/GPOWrapperProjection/GPOWrapperProjection.csproj` - `src/modules/powerrename/PowerRenameUITest/PowerRename.UITests.csproj` - `src/common/LanguageModelProvider/LanguageModelProvider.csproj` - `src/modules/Hosts/Hosts.Tests/HostsEditor.UnitTests.csproj` - `tools/StylesReportTool/StylesReportTool.vcxproj` - `src/common/interop/interop-tests/Common.Interop.UnitTests.csproj` - `tools/MonitorReportTool/MonitorReportTool.vcxproj` - `src/common/ManagedTelemetry/Telemetry/ManagedTelemetry.csproj` - `src/modules/peek/Peek.FilePreviewer/Peek.FilePreviewer.csproj` - `src/settings-ui/Settings.UI.Controls/Settings.UI.Controls.csproj` - `src/common/Themes/Themes.vcxproj` - `src/common/COMUtils/COMUtils.vcxproj` - `src/modules/cmdpal/Tests/Microsoft.CmdPal.UITests/Microsoft.CmdPal.UITests.csproj` - `src/modules/imageresizer/tests/ImageResizer.UnitTests.csproj` The changes were validated by running existing unit tests, which all passed successfully. <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed Executed all unit tests related to the modified projects, confirming that all tests passed without issues. ```
171 lines
9.7 KiB
XML
171 lines
9.7 KiB
XML
<Project>
|
|
<PropertyGroup>
|
|
<RepoRoot>$(MSBuildThisFileDirectory)</RepoRoot>
|
|
</PropertyGroup>
|
|
<Import Project="$(RepoRoot)src\Version.props" />
|
|
<PropertyGroup>
|
|
<Copyright>Copyright (C) Microsoft Corporation. All rights reserved.</Copyright>
|
|
<AssemblyCopyright>Copyright (C) Microsoft Corporation. All rights reserved.</AssemblyCopyright>
|
|
<AssemblyProduct>PowerToys</AssemblyProduct>
|
|
<AssemblyCompany>Microsoft Corp.</AssemblyCompany>
|
|
<Company>Microsoft Corporation</Company>
|
|
<Authors>Microsoft Corporation</Authors>
|
|
<Product>PowerToys</Product>
|
|
<NeutralLanguage>en-US</NeutralLanguage>
|
|
<Platforms>x64;ARM64</Platforms>
|
|
<PackageTags>PowerToys</PackageTags>
|
|
<EnableNETAnalyzers>true</EnableNETAnalyzers>
|
|
<AnalysisMode>Recommended</AnalysisMode>
|
|
<_SkipUpgradeNetAnalyzersNuGetWarning>true</_SkipUpgradeNetAnalyzersNuGetWarning>
|
|
<NuGetAuditMode>direct</NuGetAuditMode>
|
|
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion> <!-- Don't add source revision hash to the product version of binaries. -->
|
|
<PlatformTarget>$(Platform)</PlatformTarget>
|
|
</PropertyGroup>
|
|
|
|
<!--
|
|
Completely skip building test projects when BuildTests=false (e.g., Release pipeline).
|
|
This avoids InternalsVisibleTo/signing issues by not compiling test code at all.
|
|
Match: projects ending in Test, Tests, UnitTests, UITests, FuzzTests, or in a folder named Tests.
|
|
Also matches projects starting with UnitTests- (e.g., UnitTests-CommonLib).
|
|
Also removes all PackageReference/ProjectReference to prevent NuGet restore and dependency builds.
|
|
Note: Checking both 'false' and 'False' to handle YAML boolean serialization.
|
|
-->
|
|
<PropertyGroup Condition="'$(BuildTests)' == 'false' or '$(BuildTests)' == 'False'">
|
|
<_ProjectName>$(MSBuildProjectName)</_ProjectName>
|
|
<!-- Match any project ending with "Test" or "Tests" (covers UnitTests, UITests, FuzzTests, etc.) -->
|
|
<_IsSkippedTestProject Condition="$(_ProjectName.EndsWith('Test'))">true</_IsSkippedTestProject>
|
|
<_IsSkippedTestProject Condition="$(_ProjectName.EndsWith('Tests'))">true</_IsSkippedTestProject>
|
|
<!-- Match projects starting with UnitTests- or UITest- prefix -->
|
|
<_IsSkippedTestProject Condition="$(_ProjectName.StartsWith('UnitTests-'))">true</_IsSkippedTestProject>
|
|
<_IsSkippedTestProject Condition="$(_ProjectName.StartsWith('UITest-'))">true</_IsSkippedTestProject>
|
|
<!-- Match projects in a Tests folder -->
|
|
<_IsSkippedTestProject Condition="$(MSBuildProjectDirectory.Contains('\Tests\'))">true</_IsSkippedTestProject>
|
|
</PropertyGroup>
|
|
|
|
<PropertyGroup Condition="'$(_IsSkippedTestProject)' == 'true'">
|
|
<EnableDefaultItems>false</EnableDefaultItems>
|
|
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
|
|
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
|
<GenerateGlobalUsings>false</GenerateGlobalUsings>
|
|
<ImplicitUsings>disable</ImplicitUsings>
|
|
<!-- Disable all code analysis for skipped test projects -->
|
|
<EnableNETAnalyzers>false</EnableNETAnalyzers>
|
|
<RunAnalyzers>false</RunAnalyzers>
|
|
<RunAnalyzersDuringBuild>false</RunAnalyzersDuringBuild>
|
|
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
|
|
</PropertyGroup>
|
|
|
|
<PropertyGroup Condition="'$(MSBuildProjectExtension)' == '.csproj'">
|
|
<Version>$(Version).0</Version>
|
|
<RepositoryUrl>https://github.com/microsoft/PowerToys</RepositoryUrl>
|
|
<RepositoryType>GitHub</RepositoryType>
|
|
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
|
</PropertyGroup>
|
|
|
|
<PropertyGroup>
|
|
<_PropertySheetDisplayName>PowerToys.Root.Props</_PropertySheetDisplayName>
|
|
<ForceImportBeforeCppProps>$(RepoRoot)Cpp.Build.props</ForceImportBeforeCppProps>
|
|
</PropertyGroup>
|
|
|
|
|
|
<ItemGroup Condition="'$(MSBuildProjectExtension)' == '.csproj' and '$(_IsSkippedTestProject)' != 'true'">
|
|
<PackageReference Include="StyleCop.Analyzers">
|
|
<PrivateAssets>all</PrivateAssets>
|
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
|
</PackageReference>
|
|
<Compile Include="$(RepoRoot)src\codeAnalysis\GlobalSuppressions.cs" Link="GlobalSuppressions.cs" />
|
|
<AdditionalFiles Include="$(RepoRoot)src\codeAnalysis\StyleCop.json" Link="StyleCop.json" />
|
|
|
|
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers">
|
|
<PrivateAssets>all</PrivateAssets>
|
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
|
</PackageReference>
|
|
</ItemGroup>
|
|
|
|
<!-- Add ability to run tests via "msbuild /t:Test" -->
|
|
<!--
|
|
Work around an MSBuild bug where Microsoft.Common.Test.targets is missing from the Arm64 installation.
|
|
See: https://github.com/dotnet/msbuild/pull/9984
|
|
NB 1: This means that using "/t:Test" is not supported for Arm64 builds and tests will need to be run in an alternate way,
|
|
eg running tests in VS or invoking vstest.console directly.
|
|
NB 2: <Sdk> elements do not support conditions, so this is also being worked around.
|
|
Once the change referenced above is fixed, the ImportGroup below can be replaced with:
|
|
<Sdk Name="Microsoft.Build.RunVSTest" Version="1.0.319" />
|
|
-->
|
|
<ImportGroup Condition="'$(PROCESSOR_ARCHITECTURE)' != 'ARM64'">
|
|
<Import Project="Sdk.props" Sdk="Microsoft.Build.RunVSTest" Version="1.0.319" />
|
|
<Import Project="Sdk.targets" Sdk="Microsoft.Build.RunVSTest" Version="1.0.319" />
|
|
</ImportGroup>
|
|
<PropertyGroup>
|
|
<VSTestLogger>trx</VSTestLogger>
|
|
<!--
|
|
RunVSTest by default uses %VSINSTALLDIR%\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe,
|
|
but some of the CI scenarios don't define %VSINSTALLDIR%, so be explicit about where to look for vstest.
|
|
Note: $(VsInstallRoot) is a built-in MSBuild property, so should always be defined.
|
|
-->
|
|
<VSTestToolPath>$(VsInstallRoot)\Common7\IDE\CommonExtensions\Microsoft\TestWindow</VSTestToolPath>
|
|
<!-- No arm64 agents to run the tests. -->
|
|
<RunVSTest Condition="'$(Platform)' == 'ARM64'">false</RunVSTest>
|
|
</PropertyGroup>
|
|
|
|
<!-- MSBuildCache -->
|
|
<PropertyGroup>
|
|
<!-- Off by default -->
|
|
<MSBuildCacheEnabled Condition="'$(MSBuildCacheEnabled)' == ''">false</MSBuildCacheEnabled>
|
|
|
|
<!-- In Azure pipelines, use Pipeline Caching as the cache storage backend. Otherwise, use the local cache. -->
|
|
<MSBuildCachePackageName Condition="'$(TF_BUILD)' != ''">Microsoft.MSBuildCache.AzurePipelines</MSBuildCachePackageName>
|
|
<MSBuildCachePackageName Condition="'$(MSBuildCachePackageName)' == ''">Microsoft.MSBuildCache.Local</MSBuildCachePackageName>
|
|
</PropertyGroup>
|
|
|
|
<PropertyGroup Condition="'$(MSBuildCacheEnabled)' == 'true'">
|
|
<!-- Disable when running in a pipeline as the time to upload or download the massive .pch/.pchast to the cache is greater than the savings they provide. -->
|
|
<UsePrecompiledHeaders Condition="'$(TF_BUILD)' != ''">false</UsePrecompiledHeaders>
|
|
|
|
<!-- Change this to bust the cache -->
|
|
<MSBuildCacheCacheUniverse Condition="'$(MSBuildCacheCacheUniverse)' == ''">202408150737</MSBuildCacheCacheUniverse>
|
|
|
|
<!--
|
|
Visual Studio telemetry reads various ApplicationInsights.config files and other files after the project is finished, likely in a detached process.
|
|
This is acceptable and should not impact cache correctness.
|
|
-->
|
|
<MSBuildCacheAllowFileAccessAfterProjectFinishFilePatterns>
|
|
$(MSBuildCacheAllowFileAccessAfterProjectFinishFilePatterns);
|
|
\**\ApplicationInsights.config;
|
|
$(LocalAppData)\Microsoft\VSApplicationInsights\**;
|
|
$(LocalAppData)\Microsoft\Windows\INetCache\**;
|
|
A:\;
|
|
E:\;
|
|
$(windir)\**;
|
|
</MSBuildCacheAllowFileAccessAfterProjectFinishFilePatterns>
|
|
|
|
<!-- Unit tests of low-priv processes, eg the preview handler tests, may log to this location. -->
|
|
<MSBuildCacheAllowFileAccessAfterProjectFinishFilePatterns>
|
|
$(MSBuildCacheAllowFileAccessAfterProjectFinishFilePatterns);
|
|
$(USERPROFILE)\AppData\LocalLow\Microsoft\PowerToys\**;
|
|
</MSBuildCacheAllowFileAccessAfterProjectFinishFilePatterns>
|
|
|
|
<!--
|
|
This repo uses a common output directory with many projects writing duplicate outputs. Allow everything, but note this costs some performance in the form of requiring
|
|
the cache to use copies instead of hardlinks when pulling from cache.
|
|
-->
|
|
<MSBuildCacheIdenticalDuplicateOutputPatterns>$(MSBuildCacheIdenticalDuplicateOutputPatterns);**</MSBuildCacheIdenticalDuplicateOutputPatterns>
|
|
|
|
<!-- version of MSBuildCache is not part of the cache key -->
|
|
<PackagesConfigFile>$(MSBuildThisFileDirectory)packages.config</PackagesConfigFile>
|
|
<MSBuildCacheIgnoredInputPatterns>$(MSBuildCacheIgnoredInputPatterns);$(PackagesConfigFile)</MSBuildCacheIgnoredInputPatterns>
|
|
</PropertyGroup>
|
|
|
|
<PropertyGroup Condition="'$(MSBuildCacheEnabled)' == 'true' and '$(MSBuildCachePackageRoot)' == ''">
|
|
<PackagesConfigContents>$([System.IO.File]::ReadAllText("$(PackagesConfigFile)"))</PackagesConfigContents>
|
|
<MSBuildCachePackageVersion>$([System.Text.RegularExpressions.Regex]::Match($(PackagesConfigContents), 'Microsoft.MSBuildCache.*?version="(.*?)"').Groups[1].Value)</MSBuildCachePackageVersion>
|
|
<MSBuildCachePackageRoot>$(MSBuildThisFileDirectory)packages\$(MSBuildCachePackageName).$(MSBuildCachePackageVersion)</MSBuildCachePackageRoot>
|
|
<MSBuildCacheSharedCompilationPackageRoot>$(MSBuildThisFileDirectory)packages\Microsoft.MSBuildCache.SharedCompilation.$(MSBuildCachePackageVersion)</MSBuildCacheSharedCompilationPackageRoot>
|
|
</PropertyGroup>
|
|
|
|
<ImportGroup Condition="'$(MSBuildCacheEnabled)' == 'true'">
|
|
<Import Project="$(MSBuildCachePackageRoot)\build\$(MSBuildCachePackageName).props" />
|
|
<Import Project="$(MSBuildCacheSharedCompilationPackageRoot)\build\Microsoft.MSBuildCache.SharedCompilation.props" />
|
|
</ImportGroup>
|
|
</Project>
|