From a89ac475be5f8db9bb5c8930f84c4360c549111a Mon Sep 17 00:00:00 2001 From: Roxk Date: Sat, 20 Apr 2024 15:46:07 +0800 Subject: [PATCH] extension: Respect WinUI3XPLaunchProject --- WinUI3XamlPreview/TestDep/TestDep.vcxproj | 1 + WinUI3XamlPreview/TestDepSampleApp/App.xaml | 16 ++ .../TestDepSampleApp/App.xaml.cpp | 47 ++++ WinUI3XamlPreview/TestDepSampleApp/App.xaml.h | 16 ++ .../Assets/LockScreenLogo.scale-200.png | Bin 0 -> 432 bytes .../Assets/SplashScreen.scale-200.png | Bin 0 -> 5372 bytes .../Assets/Square150x150Logo.scale-200.png | Bin 0 -> 1755 bytes .../Assets/Square44x44Logo.scale-200.png | Bin 0 -> 637 bytes ...x44Logo.targetsize-24_altform-unplated.png | Bin 0 -> 283 bytes .../TestDepSampleApp/Assets/StoreLogo.png | Bin 0 -> 456 bytes .../Assets/Wide310x150Logo.scale-200.png | Bin 0 -> 2097 bytes .../TestDepSampleApp/MainWindow.idl | 9 + .../TestDepSampleApp/MainWindow.xaml | 14 ++ .../TestDepSampleApp/MainWindow.xaml.cpp | 29 +++ .../TestDepSampleApp/MainWindow.xaml.h | 27 +++ .../TestDepSampleApp/Package.appxmanifest | 60 ++++++ .../TestDepSampleApp/TestDepSampleApp.vcxproj | 201 ++++++++++++++++++ .../TestDepSampleApp.vcxproj.filters | 59 +++++ .../TestDepSampleApp/app.manifest | 19 ++ .../TestDepSampleApp/packages.config | 8 + WinUI3XamlPreview/TestDepSampleApp/pch.cpp | 1 + WinUI3XamlPreview/TestDepSampleApp/pch.h | 27 +++ WinUI3XamlPreview/TestDepSampleApp/readme.txt | 27 +++ WinUI3XamlPreview/WinUI3XamlPreview.sln | 26 +++ .../OpenLivePreview.cs | 10 +- 25 files changed, 594 insertions(+), 3 deletions(-) create mode 100644 WinUI3XamlPreview/TestDepSampleApp/App.xaml create mode 100644 WinUI3XamlPreview/TestDepSampleApp/App.xaml.cpp create mode 100644 WinUI3XamlPreview/TestDepSampleApp/App.xaml.h create mode 100644 WinUI3XamlPreview/TestDepSampleApp/Assets/LockScreenLogo.scale-200.png create mode 100644 WinUI3XamlPreview/TestDepSampleApp/Assets/SplashScreen.scale-200.png create mode 100644 WinUI3XamlPreview/TestDepSampleApp/Assets/Square150x150Logo.scale-200.png create mode 100644 WinUI3XamlPreview/TestDepSampleApp/Assets/Square44x44Logo.scale-200.png create mode 100644 WinUI3XamlPreview/TestDepSampleApp/Assets/Square44x44Logo.targetsize-24_altform-unplated.png create mode 100644 WinUI3XamlPreview/TestDepSampleApp/Assets/StoreLogo.png create mode 100644 WinUI3XamlPreview/TestDepSampleApp/Assets/Wide310x150Logo.scale-200.png create mode 100644 WinUI3XamlPreview/TestDepSampleApp/MainWindow.idl create mode 100644 WinUI3XamlPreview/TestDepSampleApp/MainWindow.xaml create mode 100644 WinUI3XamlPreview/TestDepSampleApp/MainWindow.xaml.cpp create mode 100644 WinUI3XamlPreview/TestDepSampleApp/MainWindow.xaml.h create mode 100644 WinUI3XamlPreview/TestDepSampleApp/Package.appxmanifest create mode 100644 WinUI3XamlPreview/TestDepSampleApp/TestDepSampleApp.vcxproj create mode 100644 WinUI3XamlPreview/TestDepSampleApp/TestDepSampleApp.vcxproj.filters create mode 100644 WinUI3XamlPreview/TestDepSampleApp/app.manifest create mode 100644 WinUI3XamlPreview/TestDepSampleApp/packages.config create mode 100644 WinUI3XamlPreview/TestDepSampleApp/pch.cpp create mode 100644 WinUI3XamlPreview/TestDepSampleApp/pch.h create mode 100644 WinUI3XamlPreview/TestDepSampleApp/readme.txt diff --git a/WinUI3XamlPreview/TestDep/TestDep.vcxproj b/WinUI3XamlPreview/TestDep/TestDep.vcxproj index dbb5258..0e4342e 100644 --- a/WinUI3XamlPreview/TestDep/TestDep.vcxproj +++ b/WinUI3XamlPreview/TestDep/TestDep.vcxproj @@ -19,6 +19,7 @@ 10.0.17763.0 true true + TestDepSampleApp diff --git a/WinUI3XamlPreview/TestDepSampleApp/App.xaml b/WinUI3XamlPreview/TestDepSampleApp/App.xaml new file mode 100644 index 0000000..f388be4 --- /dev/null +++ b/WinUI3XamlPreview/TestDepSampleApp/App.xaml @@ -0,0 +1,16 @@ + + + + + + + + + + + + diff --git a/WinUI3XamlPreview/TestDepSampleApp/App.xaml.cpp b/WinUI3XamlPreview/TestDepSampleApp/App.xaml.cpp new file mode 100644 index 0000000..8292692 --- /dev/null +++ b/WinUI3XamlPreview/TestDepSampleApp/App.xaml.cpp @@ -0,0 +1,47 @@ +#include "pch.h" +#include "App.xaml.h" +#include "MainWindow.xaml.h" + +using namespace winrt; +using namespace Microsoft::UI::Xaml; + +// To learn more about WinUI, the WinUI project structure, +// and more about our project templates, see: http://aka.ms/winui-project-info. + +namespace winrt::TestDepSampleApp::implementation +{ + /// + /// Initializes the singleton application object. This is the first line of authored code + /// executed, and as such is the logical equivalent of main() or WinMain(). + /// + App::App() + { + // Xaml objects should not call InitializeComponent during construction. + // See https://github.com/microsoft/cppwinrt/tree/master/nuget#initializecomponent + +#if defined _DEBUG && !defined DISABLE_XAML_GENERATED_BREAK_ON_UNHANDLED_EXCEPTION + UnhandledException([](IInspectable const&, UnhandledExceptionEventArgs const& e) + { + if (IsDebuggerPresent()) + { + auto errorMessage = e.Message(); + __debugbreak(); + } + }); +#endif + } + + /// + /// Invoked when the application is launched. + /// + /// Details about the launch request and process. + winrt::fire_and_forget App::OnLaunched([[maybe_unused]] LaunchActivatedEventArgs const& e) + { + if (co_await WinUI3XamlPreview::Preview::IsXamlPreviewLaunched()) + { + co_return; + } + window = make(); + window.Activate(); + } +} diff --git a/WinUI3XamlPreview/TestDepSampleApp/App.xaml.h b/WinUI3XamlPreview/TestDepSampleApp/App.xaml.h new file mode 100644 index 0000000..40d46e2 --- /dev/null +++ b/WinUI3XamlPreview/TestDepSampleApp/App.xaml.h @@ -0,0 +1,16 @@ +#pragma once + +#include "App.xaml.g.h" + +namespace winrt::TestDepSampleApp::implementation +{ + struct App : AppT + { + App(); + + winrt::fire_and_forget OnLaunched(Microsoft::UI::Xaml::LaunchActivatedEventArgs const&); + + private: + winrt::Microsoft::UI::Xaml::Window window{ nullptr }; + }; +} diff --git a/WinUI3XamlPreview/TestDepSampleApp/Assets/LockScreenLogo.scale-200.png b/WinUI3XamlPreview/TestDepSampleApp/Assets/LockScreenLogo.scale-200.png new file mode 100644 index 0000000000000000000000000000000000000000..7440f0d4bf7c7e26e4e36328738c68e624ee851e GIT binary patch literal 432 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDA1|-9oezr3(FqV6|IEGZ*x-#9g>~Mkr+x6^F zy~CDX2QIMs&Gcs3RnRBoxBA!*(Mfw0KTCYuYk0WlEIV>qBmPl! zq4ukrvfADX@#p8fbLY(H47N+k`FZ(FZh?cDro7>{8mkBO3>^oaIx`3!Jl)Qq)HI!+ z(S=1{o~eT)&W^=Ea8C`-17(Jv5(nHFJ{dOjGdxLVkY_y6&S1whfuFI4MM0kF0f&cO zPDVpV%nz;Id$>+0Ga5e9625-JcI)oq=#Pa3p^>8BB}21BUw@eN!-6@w%X+^`+Vn?! zryu|3T>kVWNBYyBc=7Y6H#s1Ah!OI_nezW zXTqOdkv2Az6KKBV=$yHdF^R3Fqw(TZEoNSZX>reXJ#bwX42%f|Pgg&ebxsLQ010xn AssI20 literal 0 HcmV?d00001 diff --git a/WinUI3XamlPreview/TestDepSampleApp/Assets/SplashScreen.scale-200.png b/WinUI3XamlPreview/TestDepSampleApp/Assets/SplashScreen.scale-200.png new file mode 100644 index 0000000000000000000000000000000000000000..32f486a86792a5e34cd9a8261b394c49b48f86be GIT binary patch literal 5372 zcmd5=Z){Ul6u)iv53sCbIJKLzl(EF%0tzcEY@|pLrfgF~2Dk$KFtU+$kbYqDN5W%7 z>?DBo!@y06eh{Oux>brrNT^{MO(tkiC@nH(2}}G_1|uvcMD(0{?|W^Gxo!tG~hW2Rn&7%b`-Kd_^`BCrb>XVtRKONoEw6%NswzMxk+kbocuk&}kJ#hSP z>8uR{r%LJ?I#)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e)e}RS*e;8CVyM6i8a(yO@|S709VYY(y2g zc+QxB>Bw^B^2Db~*o)=i$m-aUNQFkYy5(eJW$cez>C{POds*p3cy#tHnvActP;dBP zdEf)C;lq}&#PE?XCD<~ngrzYUg|nS`#MS`Rd7cT>xlR19P#~4Qg5!J}@glCUq)z_2 zjvyv%aSq0 z)njao1dV0XNw&c@qmj1e*jgQ$l@_urW5G4RSY#rT1z`#%3;{EB`aJK|TH^lb_3nAT z-_Q4X-(K&IS8UyqsnjYdippfmN-HT!X2MT;Dpcy~-#$k6V z|MR4vU#O&p7TC46pTflb3 zoUJ;ZRf#&8&EwXy5s%!&(q6cN62swD#FH%O-RJsjWPZN3^^@FCIQ&MxXIFo7!I#VI zkpIstuWqUV5uhgs07?k$*!`uiZ=5b#$lI|0c+XJvj(}zSE3MN#EyOK zql(#yA}~Ibl*r(s1}Z^5mmn*-n93g?-ccM+^PN?6HH~h0hjy6@XY*^i<-V)+OZ;p7 z7j`p_sT55xnYsedNIIel^QIIg7i@`2Qi}x5$!tk29$2OQI zs^kQXAKE}5ZJu$)2@Dxn?}}O@f@6@^!%9Tj+o>=jd!^ZuvBE4jb4g}Z5WMBtcmy^~ zoFGVS5|0FA!(1Q%fL?Bj*L+9ZL{mjSO8lzqrQ0UCZ)X zPwk$1HNFgaK%NxGpuXz}#ywXvf2JQ?BQ5uOZM2up4S#ieaxS$!o9o6Z=czNQb} zwAh|xLZ>+WyN%o?^uCAQw&&4o?S$DJ`WP(Hr*grL*qNXlqU0osCQ(Up5F(^$Z5;n&oJIO4uF`k&QL*j{f zU=;#MZ5{@b%qMbjTB3dh-5#mqY>%{0jgS+WdHyG literal 0 HcmV?d00001 diff --git a/WinUI3XamlPreview/TestDepSampleApp/Assets/Square44x44Logo.scale-200.png b/WinUI3XamlPreview/TestDepSampleApp/Assets/Square44x44Logo.scale-200.png new file mode 100644 index 0000000000000000000000000000000000000000..f713bba67f551ef91020b75716a4dc8ebd744b1c GIT binary patch literal 637 zcmeAS@N?(olHy`uVBq!ia0vp^5g^RL1|$oo8kjIJFu8cTIEGZ*dUI*J;2{SImxtDO zm%3!R$UazoY}x{$j0P5ABYXWr(l=jxJ6ps1W{tV=^>{Dl><3nv3A}sm=EZ)#l3`NR zpZda3^rNox*D1%NC98Z~L*6zipLw~Gxn&(Y-;KmJ+aR6eLabU-L#y8HW%7P-E_-VlLqIabbHPHKT*)fT@9iWJ7iWgOT9%0}Lrj>lztPxWq6sPw3pi z#-<=#$jjrP_DD*i!RLsn0mIA=>4~N)IMYWIf=j%-zuKCdMG%tHYot70D1| zvWa0wMhauW#S>1CnI_;>!1Q3zMA17@DOVq{MQ+{U7^a&yA+%dMCG;WNPV0i;w$tu; zX^b}UKziPM)(<;)ruW;-`)bBN+rQNM*Zs_>?n$|FVFo-e*PZb*@U7VAd+tHb4e?=Blc~}S6K)wL}r*Gf`BM#QB z+y>N$mCswb4d{^{S9v_!eQj4fTRMOwOCi?lSk9%<=vAz}jM-*PQtH@Odn1LZcd^j#o> hW$4xn+CT+ep9lJ{OAO?njobhL002ovPDHLkV1nYebbkN< literal 0 HcmV?d00001 diff --git a/WinUI3XamlPreview/TestDepSampleApp/Assets/StoreLogo.png b/WinUI3XamlPreview/TestDepSampleApp/Assets/StoreLogo.png new file mode 100644 index 0000000000000000000000000000000000000000..a4586f26bdf7841cad10f39cdffe2aca3af252c1 GIT binary patch literal 456 zcmeAS@N?(olHy`uVBq!ia0vp^Mj*_=1|;R|J2o;fF!p=8IEGZ*dUM0H=rDtTTVkd2 z(%lbKn@VS_lUaADVB&;Z6F#LM+mPsa?e>FnHo;HND^!P`-lX%BH~FOg%y&x+t*x!? zg$#_1A1kgsSvO(fw`bOmo;lrJX8byO1j^gf7qohR%mmt z@L)WX;>gqgK|tWJvQ5j;4;=gt4HXVKSMYRv5RhY5vS~TqfK_NAP*r{h!!g^BZ;w4r z7CGdsai)y;fJQc`7{Zc2b==h%o`Op$|bg6a&nL{*m7-=0>k4M4-PXlU;G-?%*(*g>iFt^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XamlPreview/TestDepSampleApp/MainWindow.idl b/WinUI3XamlPreview/TestDepSampleApp/MainWindow.idl new file mode 100644 index 0000000..5108f41 --- /dev/null +++ b/WinUI3XamlPreview/TestDepSampleApp/MainWindow.idl @@ -0,0 +1,9 @@ +namespace TestDepSampleApp +{ + [default_interface] + runtimeclass MainWindow : Microsoft.UI.Xaml.Window + { + MainWindow(); + Int32 MyProperty; + } +} diff --git a/WinUI3XamlPreview/TestDepSampleApp/MainWindow.xaml b/WinUI3XamlPreview/TestDepSampleApp/MainWindow.xaml new file mode 100644 index 0000000..d50e901 --- /dev/null +++ b/WinUI3XamlPreview/TestDepSampleApp/MainWindow.xaml @@ -0,0 +1,14 @@ + + + + + + + diff --git a/WinUI3XamlPreview/TestDepSampleApp/MainWindow.xaml.cpp b/WinUI3XamlPreview/TestDepSampleApp/MainWindow.xaml.cpp new file mode 100644 index 0000000..8f4a69e --- /dev/null +++ b/WinUI3XamlPreview/TestDepSampleApp/MainWindow.xaml.cpp @@ -0,0 +1,29 @@ +#include "pch.h" +#include "MainWindow.xaml.h" +#if __has_include("MainWindow.g.cpp") +#include "MainWindow.g.cpp" +#endif + +using namespace winrt; +using namespace Microsoft::UI::Xaml; + +// To learn more about WinUI, the WinUI project structure, +// and more about our project templates, see: http://aka.ms/winui-project-info. + +namespace winrt::TestDepSampleApp::implementation +{ + int32_t MainWindow::MyProperty() + { + throw hresult_not_implemented(); + } + + void MainWindow::MyProperty(int32_t /* value */) + { + throw hresult_not_implemented(); + } + + void MainWindow::myButton_Click(IInspectable const&, RoutedEventArgs const&) + { + myButton().Content(box_value(L"Clicked")); + } +} diff --git a/WinUI3XamlPreview/TestDepSampleApp/MainWindow.xaml.h b/WinUI3XamlPreview/TestDepSampleApp/MainWindow.xaml.h new file mode 100644 index 0000000..0743ba7 --- /dev/null +++ b/WinUI3XamlPreview/TestDepSampleApp/MainWindow.xaml.h @@ -0,0 +1,27 @@ +#pragma once + +#include "MainWindow.g.h" + +namespace winrt::TestDepSampleApp::implementation +{ + struct MainWindow : MainWindowT + { + MainWindow() + { + // Xaml objects should not call InitializeComponent during construction. + // See https://github.com/microsoft/cppwinrt/tree/master/nuget#initializecomponent + } + + int32_t MyProperty(); + void MyProperty(int32_t value); + + void myButton_Click(IInspectable const& sender, Microsoft::UI::Xaml::RoutedEventArgs const& args); + }; +} + +namespace winrt::TestDepSampleApp::factory_implementation +{ + struct MainWindow : MainWindowT + { + }; +} diff --git a/WinUI3XamlPreview/TestDepSampleApp/Package.appxmanifest b/WinUI3XamlPreview/TestDepSampleApp/Package.appxmanifest new file mode 100644 index 0000000..1aeea23 --- /dev/null +++ b/WinUI3XamlPreview/TestDepSampleApp/Package.appxmanifest @@ -0,0 +1,60 @@ + + + + + + + + + + TestDepSampleApp + Roxk + Assets\StoreLogo.png + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/WinUI3XamlPreview/TestDepSampleApp/TestDepSampleApp.vcxproj b/WinUI3XamlPreview/TestDepSampleApp/TestDepSampleApp.vcxproj new file mode 100644 index 0000000..59d96f5 --- /dev/null +++ b/WinUI3XamlPreview/TestDepSampleApp/TestDepSampleApp.vcxproj @@ -0,0 +1,201 @@ + + + + + + + + true + true + true + {349a4a66-4618-4c96-9cb1-771c01655ce4} + TestDepSampleApp + TestDepSampleApp + + $(RootNamespace) + en-US + 16.0 + false + true + Windows Store + 10.0 + 10.0 + 10.0.17763.0 + true + true + + + + + Debug + Win32 + + + Debug + x64 + + + Debug + ARM64 + + + Release + Win32 + + + Release + x64 + + + Release + ARM64 + + + + Application + v143 + Unicode + true + + + true + true + + + false + true + false + + + + + + + + + + + Use + pch.h + $(IntDir)pch.pch + Level4 + %(AdditionalOptions) /bigobj + + + + + _DEBUG;%(PreprocessorDefinitions) + + + + + NDEBUG;%(PreprocessorDefinitions) + + + true + true + + + + + Designer + + + + + + + + + App.xaml + + + MainWindow.xaml + + + + + + + + + Create + + + App.xaml + + + MainWindow.xaml + + + + + + Code + MainWindow.xaml + + + + + false + + + + + + + + + + + + + + + + + + + + + {a4c036f2-eab5-4447-ba06-64d6c3e1aff1} + + + + + true + + + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + + + + + + + \ No newline at end of file diff --git a/WinUI3XamlPreview/TestDepSampleApp/TestDepSampleApp.vcxproj.filters b/WinUI3XamlPreview/TestDepSampleApp/TestDepSampleApp.vcxproj.filters new file mode 100644 index 0000000..1854fe9 --- /dev/null +++ b/WinUI3XamlPreview/TestDepSampleApp/TestDepSampleApp.vcxproj.filters @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + + + {349a4a66-4618-4c96-9cb1-771c01655ce4} + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/WinUI3XamlPreview/TestDepSampleApp/app.manifest b/WinUI3XamlPreview/TestDepSampleApp/app.manifest new file mode 100644 index 0000000..2ad748a --- /dev/null +++ b/WinUI3XamlPreview/TestDepSampleApp/app.manifest @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + PerMonitorV2 + + + \ No newline at end of file diff --git a/WinUI3XamlPreview/TestDepSampleApp/packages.config b/WinUI3XamlPreview/TestDepSampleApp/packages.config new file mode 100644 index 0000000..5bfb1ee --- /dev/null +++ b/WinUI3XamlPreview/TestDepSampleApp/packages.config @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/WinUI3XamlPreview/TestDepSampleApp/pch.cpp b/WinUI3XamlPreview/TestDepSampleApp/pch.cpp new file mode 100644 index 0000000..1d9f38c --- /dev/null +++ b/WinUI3XamlPreview/TestDepSampleApp/pch.cpp @@ -0,0 +1 @@ +#include "pch.h" diff --git a/WinUI3XamlPreview/TestDepSampleApp/pch.h b/WinUI3XamlPreview/TestDepSampleApp/pch.h new file mode 100644 index 0000000..e13bfd8 --- /dev/null +++ b/WinUI3XamlPreview/TestDepSampleApp/pch.h @@ -0,0 +1,27 @@ +#pragma once +#include +#include +#include +#include + +// Undefine GetCurrentTime macro to prevent +// conflict with Storyboard::GetCurrentTime +#undef GetCurrentTime + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include diff --git a/WinUI3XamlPreview/TestDepSampleApp/readme.txt b/WinUI3XamlPreview/TestDepSampleApp/readme.txt new file mode 100644 index 0000000..8b38525 --- /dev/null +++ b/WinUI3XamlPreview/TestDepSampleApp/readme.txt @@ -0,0 +1,27 @@ +======================================================================== + TestDepSampleApp Project Overview +======================================================================== + +This project demonstrates how to get started writing WinUI3 apps directly +with standard C++, using the Windows App SDK and C++/WinRT packages and +XAML compiler support to generate implementation headers from interface +(IDL) files. These headers can then be used to implement the local +Windows Runtime classes referenced in the app's XAML pages. + +Steps: +1. Create an interface (IDL) file to define any local Windows Runtime + classes referenced in the app's XAML pages. +2. Build the project once to generate implementation templates under + the "Generated Files" folder, as well as skeleton class definitions + under "Generated Files\sources". +3. Use the skeleton class definitions for reference to implement your + Windows Runtime classes. + +======================================================================== +Learn more about Windows App SDK here: +https://docs.microsoft.com/windows/apps/windows-app-sdk/ +Learn more about WinUI3 here: +https://docs.microsoft.com/windows/apps/winui/winui3/ +Learn more about C++/WinRT here: +http://aka.ms/cppwinrt/ +======================================================================== diff --git a/WinUI3XamlPreview/WinUI3XamlPreview.sln b/WinUI3XamlPreview/WinUI3XamlPreview.sln index 6726f77..0fcf476 100644 --- a/WinUI3XamlPreview/WinUI3XamlPreview.sln +++ b/WinUI3XamlPreview/WinUI3XamlPreview.sln @@ -31,6 +31,8 @@ Project("{C7167F0D-BC9F-4E6E-AFE1-012C56B48DB5}") = "TestAppToBePackagedPackage" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestAppToBePackaged", "TestAppToBePackaged\TestAppToBePackaged\TestAppToBePackaged.vcxproj", "{8EA2962F-87E7-4D4E-9693-59E9F54A0290}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestDepSampleApp", "TestDepSampleApp\TestDepSampleApp.vcxproj", "{349A4A66-4618-4C96-9CB1-771C01655CE4}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -315,6 +317,30 @@ Global {8EA2962F-87E7-4D4E-9693-59E9F54A0290}.Release|x64.Build.0 = Release|x64 {8EA2962F-87E7-4D4E-9693-59E9F54A0290}.Release|x86.ActiveCfg = Release|Win32 {8EA2962F-87E7-4D4E-9693-59E9F54A0290}.Release|x86.Build.0 = Release|Win32 + {349A4A66-4618-4C96-9CB1-771C01655CE4}.Debug|Any CPU.ActiveCfg = Debug|x64 + {349A4A66-4618-4C96-9CB1-771C01655CE4}.Debug|Any CPU.Build.0 = Debug|x64 + {349A4A66-4618-4C96-9CB1-771C01655CE4}.Debug|Any CPU.Deploy.0 = Debug|x64 + {349A4A66-4618-4C96-9CB1-771C01655CE4}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {349A4A66-4618-4C96-9CB1-771C01655CE4}.Debug|ARM64.Build.0 = Debug|ARM64 + {349A4A66-4618-4C96-9CB1-771C01655CE4}.Debug|ARM64.Deploy.0 = Debug|ARM64 + {349A4A66-4618-4C96-9CB1-771C01655CE4}.Debug|x64.ActiveCfg = Debug|x64 + {349A4A66-4618-4C96-9CB1-771C01655CE4}.Debug|x64.Build.0 = Debug|x64 + {349A4A66-4618-4C96-9CB1-771C01655CE4}.Debug|x64.Deploy.0 = Debug|x64 + {349A4A66-4618-4C96-9CB1-771C01655CE4}.Debug|x86.ActiveCfg = Debug|Win32 + {349A4A66-4618-4C96-9CB1-771C01655CE4}.Debug|x86.Build.0 = Debug|Win32 + {349A4A66-4618-4C96-9CB1-771C01655CE4}.Debug|x86.Deploy.0 = Debug|Win32 + {349A4A66-4618-4C96-9CB1-771C01655CE4}.Release|Any CPU.ActiveCfg = Release|x64 + {349A4A66-4618-4C96-9CB1-771C01655CE4}.Release|Any CPU.Build.0 = Release|x64 + {349A4A66-4618-4C96-9CB1-771C01655CE4}.Release|Any CPU.Deploy.0 = Release|x64 + {349A4A66-4618-4C96-9CB1-771C01655CE4}.Release|ARM64.ActiveCfg = Release|ARM64 + {349A4A66-4618-4C96-9CB1-771C01655CE4}.Release|ARM64.Build.0 = Release|ARM64 + {349A4A66-4618-4C96-9CB1-771C01655CE4}.Release|ARM64.Deploy.0 = Release|ARM64 + {349A4A66-4618-4C96-9CB1-771C01655CE4}.Release|x64.ActiveCfg = Release|x64 + {349A4A66-4618-4C96-9CB1-771C01655CE4}.Release|x64.Build.0 = Release|x64 + {349A4A66-4618-4C96-9CB1-771C01655CE4}.Release|x64.Deploy.0 = Release|x64 + {349A4A66-4618-4C96-9CB1-771C01655CE4}.Release|x86.ActiveCfg = Release|Win32 + {349A4A66-4618-4C96-9CB1-771C01655CE4}.Release|x86.Build.0 = Release|Win32 + {349A4A66-4618-4C96-9CB1-771C01655CE4}.Release|x86.Deploy.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/extensions/WinUI3XamlPreviewVS2022/WinUI3XamlPreviewVS2022/OpenLivePreview.cs b/extensions/WinUI3XamlPreviewVS2022/WinUI3XamlPreviewVS2022/OpenLivePreview.cs index c3c53c6..ead9e10 100644 --- a/extensions/WinUI3XamlPreviewVS2022/WinUI3XamlPreviewVS2022/OpenLivePreview.cs +++ b/extensions/WinUI3XamlPreviewVS2022/WinUI3XamlPreviewVS2022/OpenLivePreview.cs @@ -119,12 +119,18 @@ private async Task OpenAsync(string path, CancellationToken cancellationToken) } var isExeProjectCpp = (await docProject.GetAttributeAsync("ConfigurationType")) == "Application"; var isExeProjectCs = (await docProject.GetAttributeAsync("OutputType")) == "WinExe"; - var isExeProject = isExeProjectCpp || isExeProjectCs; + var customLaunchProjectName = await docProject.GetAttributeAsync("WinUI3XPLaunchProject"); + var isExeProjectCustom = customLaunchProjectName != null; + var isExeProject = isExeProjectCpp || isExeProjectCs || isExeProjectCustom; string appPath; string host; string queries; if (isExeProject) { + if (isExeProjectCustom) + { + docProject = await VS.Solutions.FindProjectsAsync(customLaunchProjectName ?? "") ?? throw new InvalidOperationException($"Project {customLaunchProjectName} doesn't exist"); + } (appPath, host, queries) = await OpenExeProjectAsync(docProject, cancellationToken); } else @@ -189,7 +195,6 @@ class PackageFormat { }; class SinglePackageProject : PackageFormat { } class Wap(string targetName) : PackageFormat { public string TargetName => targetName; } -#pragma warning disable VSEXTPREVIEW_PROJECTQUERY_PROPERTIES_BUILDPROPERTIES // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. private async Task CheckPackageFormatAsync(Project docProject, CancellationToken token) { var isSinglePackageProject = (await docProject.GetAttributeAsync("AppxPackage")) == "true"; @@ -223,7 +228,6 @@ class Wap(string targetName) : PackageFormat { public string TargetName => targe } return null; } -#pragma warning restore VSEXTPREVIEW_PROJECTQUERY_PROPERTIES_BUILDPROPERTIES // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. private async Task<(string appPath, string host, string quries)> OpenExeProjectAsync(Project docProject, CancellationToken token) {