fix compiling issue

This commit is contained in:
Shawn Yuan (from Dev Box)
2026-02-11 14:54:03 +08:00
parent 58f9b007a6
commit ad4a5cdfe7
6 changed files with 29 additions and 5 deletions

View File

@@ -216,7 +216,7 @@ namespace Microsoft.PowerToys.UITest
Rectangle bounds = new Rectangle(0, 0, screenWidth, screenHeight);
using (Bitmap bitmap = new Bitmap(bounds.Width, bounds.Height, PixelFormat.Format24bppRgb))
{
using (Graphics g = Graphics.FromImage(bitmap))
using (System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(bitmap))
{
g.CopyFromScreen(bounds.Location, Point.Empty, bounds.Size);

View File

@@ -12,6 +12,8 @@
<TargetFramework>net9.0-windows10.0.26100.0</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<PublishTrimmed>false</PublishTrimmed>
<!-- Suppress code analysis warnings for test library -->
<NoWarn>$(NoWarn);CA1305;CA1310;CA2101</NoWarn>
</PropertyGroup>
<ItemGroup>
@@ -20,6 +22,7 @@
<PackageReference Include="System.IO.Abstractions" />
<PackageReference Include="System.Text.RegularExpressions" />
<PackageReference Include="CoenM.ImageSharp.ImageHash" />
<PackageReference Include="System.Drawing.Common" />
</ItemGroup>
<ItemGroup>

View File

@@ -62,11 +62,12 @@
<HasPackageAndPublishMenu>true</HasPackageAndPublishMenu>
</PropertyGroup>
<!-- Only enable Native AOT for Release builds to avoid System.Private.CoreLib.dll version conflicts during development -->
<!-- Temporarily disable Native AOT until C++ Desktop Development workload is installed -->
<!-- TODO: Re-enable after installing Desktop Development for C++ in Visual Studio -->
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
<PublishTrimmed>true</PublishTrimmed>
<PublishSingleFile>true</PublishSingleFile>
<PublishAot>true</PublishAot>
<PublishTrimmed>false</PublishTrimmed>
<PublishSingleFile>false</PublishSingleFile>
<PublishAot>false</PublishAot>
</PropertyGroup>
<!-- For Debug builds, use standard JIT compilation -->

View File

@@ -3,6 +3,13 @@
<Import Project="$(RepoRoot)src\Common.Dotnet.CsWinRT.props" />
<Import Project="$(RepoRoot)src\Common.SelfContained.props" />
<!-- Force WebView2 to use Win32/WinForms mode instead of WinRT mode -->
<!-- Required because Settings.UI.Library has UseWinUI=true which triggers WebView2UseWinRT -->
<PropertyGroup>
<WebView2UseWinRT>false</WebView2UseWinRT>
<WebView2EnableCsWinRTProjection>false</WebView2EnableCsWinRTProjection>
</PropertyGroup>
<PropertyGroup>
<ImplicitUsings>enable</ImplicitUsings>
<UseWindowsForms>true</UseWindowsForms>

View File

@@ -3,6 +3,13 @@
<Import Project="$(RepoRoot)src\Common.Dotnet.CsWinRT.props" />
<Import Project="$(RepoRoot)src\Common.SelfContained.props" />
<!-- Force WebView2 to use Win32/WinForms mode instead of WinRT mode -->
<!-- Required because Settings.UI.Library has UseWinUI=true which triggers WebView2UseWinRT -->
<PropertyGroup>
<WebView2UseWinRT>false</WebView2UseWinRT>
<WebView2EnableCsWinRTProjection>false</WebView2EnableCsWinRTProjection>
</PropertyGroup>
<PropertyGroup>
<ImplicitUsings>enable</ImplicitUsings>
<UseWindowsForms>true</UseWindowsForms>

View File

@@ -2,6 +2,12 @@
<!-- Look at Directory.Build.props in root for common stuff as well -->
<Import Project="$(RepoRoot)src\Common.Dotnet.CsWinRT.props" />
<!-- Force WebView2 to use Win32/WinForms mode for unit tests -->
<PropertyGroup>
<WebView2UseWinRT>false</WebView2UseWinRT>
<WebView2EnableCsWinRTProjection>false</WebView2EnableCsWinRTProjection>
</PropertyGroup>
<PropertyGroup>
<AssemblyTitle>UnitTests-SvgPreviewHandler</AssemblyTitle>
<AssemblyDescription>PowerToys UnitTests-SvgPreviewHandler</AssemblyDescription>