
Winui Dev Workflow
- 113 installs
- 370 repo stars
- Updated July 27, 2026
- microsoft/win-dev-skills
winui-dev-workflow is an agent skill for building and running WinUI 3 apps with BuildAndRun.ps1, winapp run, and error diagnosis.
About
The winui-dev-workflow skill provides the build and run workflow for WinUI 3 apps including project creation, BuildAndRun.ps1 execution, winapp run launching, error diagnosis, and prerequisite verification. New apps scaffold with dotnet new winui-mvvm creating CommunityToolkit.Mvvm MVVM structure with TitleBar, MicaBackdrop, and Frame navigation without pre-creating directories. Package installs use dotnet add package without pinned versions to get latest stable APIs. BuildAndRun.ps1 checks Developer Mode, finds the csproj, auto-detects x64 or ARM64, builds with MSBuild, and launches via winapp run --debug-output. Agents must invoke the script asynchronously because sync mode blocks for the app lifetime, while -Detach and -SkipRun are safe for synchronous calls. Common errors map Developer Mode, missing types, XAML binding failures, OneTime x:Bind blank UI, silent XAML compiler crashes, and package install failures to specific fixes. Prerequisites require Windows 10 v1903+, Developer Mode, .NET SDK 8.0 minimum, winapp CLI, and WinUI templates, with missing tools routed to /winui-setup rather than agent self-install. Critical rules forbid running packaged exe directly, adding Windo.
- Scaffolds MVVM WinUI apps via dotnet new winui-mvvm template.
- BuildAndRun.ps1 handles Developer Mode check, build, and winapp run launch.
- Requires async invocation because the script stays attached to running apps.
- Maps common CS, XAML, and package errors to documented fixes.
- Routes missing prerequisites to /winui-setup instead of agent self-install.
Winui Dev Workflow by the numbers
- 113 all-time installs (skills.sh)
- Ranked #73 of 154 .NET & C# skills by installs in the Skillselion catalog
- Security screen: LOW risk (skills.sh audit)
- Data as of Jul 27, 2026 (Skillselion catalog sync)
winui-dev-workflow capabilities & compatibility
- Capabilities
- winui mvvm project scaffolding · buildandrun.ps1 automated build and launch · common winui xaml and package error diagnosis · prerequisite verification and winui setup routin · winapp run launch with async agent invocation gu
- Use cases
- frontend · debugging
- Platforms
- Windows
What winui-dev-workflow says it does
dotnet new winui-mvvm -n <AppName>
npx skills add https://github.com/microsoft/win-dev-skills --skill winui-dev-workflowAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 113 |
|---|---|
| repo stars | ★ 370 |
| Security audit | 3 / 3 scanners passed |
| Last updated | July 27, 2026 |
| Repository | microsoft/win-dev-skills ↗ |
How do I build and run a WinUI 3 app and fix common scaffold, XAML, and launch errors?
Build and run WinUI 3 apps with BuildAndRun.ps1, winapp run, scaffold templates, and common error diagnosis.
Who is it for?
Developers building or running WinUI 3 projects who need BuildAndRun.ps1 automation and error troubleshooting.
Skip if: Skip for non-WinUI platforms, code quality review before commit, or environments without Windows prerequisites.
When should I use this skill?
User builds, runs, or fixes build errors in a WinUI 3 project or scaffolds a new WinUI MVVM app.
What you get
A running WinUI app launched via winapp run with build errors diagnosed and prerequisites verified.
Files
Create or Open a Project
New app — scaffold with a template:
dotnet new winui-mvvm -n <AppName>
cd <AppName>Creates an MVVM project with CommunityToolkit.Mvvm, TitleBar, MicaBackdrop, and Frame navigation. Do NOT mkdir first — -n creates the folder.
Existing app — read the .csproj to understand:
<TargetFramework>(e.g.,net10.0-windows10.0.26100.0)<PackageReference>versions (WindowsAppSDK, CommunityToolkit)- Project structure and established patterns
Install Packages
dotnet add package <Name>Never specify --version — omitting it gets the latest stable and avoids outdated API mismatches.
Build & Run
Use the BuildAndRun.ps1 script (included with this skill) — it handles everything:
.\BuildAndRun.ps1Invoke the script with `mode: "async"`. The script stays attached to the running app so a mode: "sync" call blocks your turn for the entire lifetime of the app. The output contains the PID of the running app once the app starts, which looks like this:
✅ <pkg> launched (PID: 12345)What the script does automatically: 1. Checks Developer Mode is enabled (fails fast if not) 2. Finds the .csproj in the current directory 3. Auto-detects platform (x64 or ARM64) 4. Builds with MSBuild (or falls back to dotnet build) 5. Finds the build output folder 6. Launches with winapp run --debug-output
Options:
.\BuildAndRun.ps1 # auto-find csproj, build, run (should use async invocation)
.\BuildAndRun.ps1 MyApp.csproj # explicit project
.\BuildAndRun.ps1 -Detach # run in detached mode, no debug output or exceptions (safe to use mode: "sync")
.\BuildAndRun.ps1 -SkipRun # build only (safe to use mode: "sync")
.\BuildAndRun.ps1 /p:Configuration=Release # override defaultsIf build fails: Read ALL errors, batch-fix them in one pass, then run BuildAndRun.ps1 again.
If the app crashes on launch: read_powershell the shell — first-chance exceptions appear in the output.
Common Errors
| Error | Fix |
|---|---|
| Developer Mode not enabled | Settings → System → For developers → On |
| CS0234/CS0246 missing type | Add using or dotnet add package |
| NETSDK1136 platform required | BuildAndRun.ps1 handles this automatically |
| XLS0414 XAML type not found | Add xmlns declaration |
| XDG0062 binding path missing | Check x:Bind property exists on ViewModel |
| Blank window after launch | x:Bind defaults to OneTime — add Mode=OneWay |
| App silently exits | Use winapp run, never run the .exe directly |
| XAML compiler crashes silently | Remove any PresentationCore.dll / System.Windows references |
| 0x80073CF6 package install failed | Run winapp init, check manifest publisher matches cert |
| 0x8007000B bad image format | Wrong platform target — use x64 or ARM64, not AnyCPU |
Prerequisites
| Requirement | Minimum | Recommended (fresh installs) | Install command |
|---|---|---|---|
| Windows 10 v1903+ | — | — | — |
| Developer Mode | enabled | enabled | Settings → Advanced → Developer Mode → On |
| .NET SDK | 8.0 | 10.0 | winget install Microsoft.DotNet.SDK.10 |
| winapp CLI | 0.3 | latest | winget install Microsoft.WinAppCLI |
| WinUI templates | any | latest | dotnet new install Microsoft.WindowsAppSDK.WinUI.CSharp.Templates |
If any of these are missing when you try to access them — winapp or dotnet not recognized, the WinUI templates aren't installed, Developer Mode is off — do not try to install them yourself and do not try to work around it. Stop and tell the user the prerequisite is missing and ask them to run /winui-setup (a user-invoked skill that installs and verifies everything). Once they've finished, retry the failed command.
Critical Rules
- ❌ NEVER run the packaged .exe directly — always use
winapp runorBuildAndRun.ps1 - ❌ NEVER add
<WindowsPackageType>Noneto work around launch issues - ❌ NEVER delete
Package.appxmanifest - ❌ NEVER use
AnyCPU— always x64 or ARM64
References
BuildAndRun.ps1— included with this skill, handles build + run automatically
MZ����@��� �!�L�!This program cannot be run in DOS mode.
$PEL���" 0�� � `���O����T H.text$� � `.rsrc���@@.reloc�@B��HI��(
*^(
�T%�}*:(
}*:(
}*:(
}*0Z�U%rp�%r5p�(+�~
�r�p(+��U%r�p�%r�p�(+�*08(+
(
+(
o
o
(
-�o
*0��%r)pr_pr�ps �%r�pr�ps �%r!prepr�ps �%r�pr�pr�ps �%rEpr�pr�ps �%r�pr_pr�ps �%r7pr�pr�ps �%r�pr_pr�ps �%r9pr�pr�ps �% rpr?pr�ps �%
r�prpr�ps �%rkpr�ps �%r�pr�ps �%
rpr_pr�ps �%r�prl pr
ps �%r�
prLpr�ps �%rpr�pr
ps �%r\
pr�
ps �%r,pr�ps �%r�pr�ps �%r
pr�ps �%r�pr5pr�ps �%r�pr3pr�ps �%r�pr�pr�ps �%r=pr}pr�ps �%rprxpr�ps �%rprbps �%r�ps �%rps �%r\pr�ps �%r�ps �(+�(� *r(
}
}}*{
*{*{*08(+
&(
+(
oo!
("
-�o#
*0��%rJpr�pr�ps�%r�pr�pr�ps�%r�pr�pr�ps�%r�prmpr}ps�%rkprpr.ps�%r�prpr#ps�%rkpr�pr�ps�%rDpr�pr�ps�(+�&(
�'*r(
}(})}**{(*{)*{**FrGpo$
(%
*0%sR
}K~,�Ss&
o'
*0
o(
o)
+So*
�o+
o,
-
r�po-
-
r�po-
,
- r�po-
,_,�o.
-��
,o/
�9�o0
(1
+h(2
o3
(4
r"po5
,F�o6
%-&+o7
%-&~8
rLpo-
-rbpo-
,*(9
-�,*,**_o
(:
*.s;
�,*V~1~2~3(+*�o=
o>
~O%-&~N�Vs?
%�Oo@
*0�(A
t)
oB
u),*(C
(D
(E
(F
-*oG
-(H
oI
rxpr�poJ
+* (H
oI
rxpr�poJ
r�poK
(L
oG
%-&+(H
oI
rxpr�poJ
oM
(,*,oM
(&*0�(A
t-
oN
%-&+o7
(O
,*oM
(&&(
+P(
ooP
,9~3oM
�% o�% o�% o�(Q
(R
*("
-�*0p~ oS
-*o,'~1�%�%o�(Q
(R
+.~2�%�%o%-&r�p�(Q
(R
*(T
*0 �r�pr�prpr*prJpr�p((+sV
�1rg prw pr� pr*pr'!prg p((+sV
�2r("pr8"pr�"pr*pr�"pr("p((+sV
�3*.~4( +*�o=
o>
~P%-&�!sX
%�P�d%
"�o
+*0�(A
t2
oB
u5-*oZ
o7
~5o[
-*o\
u5-u4
,
o]
,+,hrm#po\
u5,*o^
�(+(+,oZ
o7
~4oM
�%�%�(Q
(R
*(T
*0 �r�#pr�#pr�#pr�$pr�$pr�#p((+sV
�4(a
sb
%r&poc
&%r+&poc
&%rI&poc
&%rc&poc
&%rq&poc
&%r{&poc
&%r�&poc
&�5*V~6~7~8(+*0lo=
o>
~Q%-&�&sX
%�Q�d% �!�o
+~R%-&�'sX
%�R�d% �!�o
+*0� (A
t6
od
u)-
u7
-++oe
of
(g
+ of
(g
+-*r�&p(h
,~6oM
(
+(Q
(R
*r�&p(h
,~7oM
(
+(Q
(R
*0P
(A
t4
oi
o7
r'p(h
-
r#'poj
,~8oM
(
+(Q
(R
*(T
*0 �rE'prU'pr�'pr�(prE'p((+sV
�6r�(pr
)prL)pr�(pr�(p((+sV
�7r9*prI*pr�*pr�(pr9*p((+sV
�8*.~9( +*�o=
o>
~S%-&�,sX
%�S�d% �"�o
+*0((A
t9
ok
(l
+X(m
on
(o
+3(p
oq
o7
r�+p(h
- r�+p(h
,+ (r
-�- (s
-�-*ot
ou
(v
-*ow
(g
ot
ox
o7
�n%_�oy
oz
1%o{
(|
(}
o~
(%
~9oM
�% �%�(Q
(R
*(T
*0 5r�+pr�+pr:,pr�-pr�-pr�+p((+sV
�9*.~:( +*�o=
o>
~T%-&�1sX
%�T�d%
"�o
+*0sW
(A
t2oZ
u)-*oe
of
(g
r�.p(
,*o\
u4
-* oi
(3}U{U-*~;�Xs�
(+-*(C
o�
�(�
(�
-o�
o7
o$
r�.po-
-*(2-*~:oM
�%{U�(Q
(R
*0%
+oI
r�.po-
,*o�
-�*0Fu7
-uD-+'of
(g
+o�
of
(g
+o7
*(T
*0 �r/pr/prZ/pr�$pr_0pr/p((+sV
�: �U%r2p�%r2p�%r�p�%rq&p�%r,2p�%rI&p�%rB2p�%rT2p�%rf2p��;*j~<~=~>~?(+*0�o=
o>
~V%-&�8sX
%�V�d% �"�o
+~W%-&�9sX
%�W�d% �!�o
+~X%-&�:sX
%�X�d% �!�o
+*0M(A
t-
oN
%-&+o7
,)r�po�
,~<oM
(
+(Q
(R
*0�(A
t)
oe
of
(g
rt2p(h
9�o�
o7
r�2p(h
-
r�2p(h
,(C
o�
�(�
(F
%-&+oI
%-& ~o�
,*r�2po-
-
r�2p(h
,~=oM
(
+(Q
(R
r�2p(h
9�(C
o�
�(�
(F
%-&+oI
%-&o�
o7
r�po-
-+.o�
Xo~
~o�
-~o�
,*~?oM
�%o�
o7
�(Q
(R
*0�(A
t7
of
(g
r�2p(
,*oB
u),
o�
3*(C
�(�
(F
,Xo�
%-&+oI
%-&r�pr�po�
-oI
r�2po-
,S~>oM
(
+(Q
(R
*oB
uq-
oB
uC,~>oM
(
+(Q
(R
*(T
*0 �r
3pr3prJ3pr�3pr
3p((+sV
�<r4pr4prK4pr�3pr4p((+sV
�=r5pr 5prV5pr�3pr5p((+sV
�>r�5pr�5pr56pr�3pr�5p((+sV
�?*.~@( +*�o=
o>
~Y%-&�?sX
%�Y�d% �"�o
+*0�(A
tE
o�
(+~[%-&~Z�[s�
%�[(+,*o�
(+~\%-&~Z�\s�
%�\(+,*o�
(+~]%-&~Z�]s�
%�](+o�
8�o�
(C
o�
�(�
(�
,' oI
r�po-
->r�6po-
-0+do�
o7
o$
r�6po-
-r�6po-
,6~@oM
�%oe
of
(g
�(Q
(R
�o.
::����
,o/
�*��y
(T
*0 hr7pr 7prj7pr�(pr+8pr7p((+sV
�@�U%rf9p�%r�9p�%r�9p�%r�9p�%r�9p��A*j~B~C~E~D(+*�o=
o>
~^%-&�Ds�
%�^o�
*0s(�
o0
(1
+R(2
o3
r:po�
,7o3
(4
r$:po5
-(�
o6
, o7
(E(9
-�*0�(�
�&�qo�
o�
8Io�
o�
o�
~F o[
,So�
~`%-&~_�`s�
%�`(+-'(G~C�% �(Q
(�
o�
o�
8�o�
o�
r6:po-
-r\:po-
,"(G~D(
+(Q
(�
~Go�
o�
8 o�
tvo�
o�
o�
o�
r�:po-
-x
(F-oo�
o�
r�:p(h
-r�:poj
+
r�:po-
-4
-0
r�po-
,"(G~E(
+(Q
(�
�n%,�o�
�o�
r�:po-
-M�n%.�o�
�i26
r�:po-
-((G~B�%�(Q
(�
o.
:����� uM,o/
�o.
:J����,o/
�o.
:�����
,o/
�*Ad
2;��^[w
zr�po-
-r�:po-
�**0�
o�
9�o�
Yo�
Y2o�
o�
/qo�
o�
(�
(�
(�
(�
X%o�
o�
oz
XX(�
(�
(�
o3
o�
o�
(�
*o3
(�
(�
(�
s�
(�
*(T
*0`r�:pr�:pr2;pr�$pr�:p(�U%r)<p�sV
�BrG<prW<pr�<pr�$prG<p(�U%r)<p�sV
�Crb=prr=pr�=pr�$prb=p(�U%r)<p�sV
�Dr�>pr�>pr?pr�$pr�>p(�U%r)<p�sV
�E(a
sb
%r�?poc
&%r�?poc
&%r@poc
&%r&@poc
&%rF@poc
&%rd@poc
&%r|@poc
&%r2poc
&%r2poc
&%r�@poc
&%r�@poc
&%r�@poc
&%r�@poc
&%r�@poc
&%rApoc
&%r&Apoc
&%r@Apoc
&%rNApoc
&%rB2poc
&%rjApoc
&%rT2poc
&%r|Apoc
&%r�.poc
&%r�Apoc
&%r�Apoc
&%r�Apoc
&%r�Apoc
&%rBpoc
&%r*Bpoc
&�FrBBps�
�G*B~H~I(+*�o=
o>
~d%-&�Ls�
%�do�
*0�(a
s�
(�
o0
(1
8�(2
o3
r:po�
9� (�
o6
9�o7
(�
�&ݖ(a
sb
o�
o�
+o�
o�
o�
oc
&o.
-��,o/
� o3
(�
sg%r�po[
ob%rlBpo[
od% o3
ofo�
(9
:���o�
-*(�
o(
o)
8� o*
o�
(O
:xr|Bpo�
9f(4
r|Bpo�
-+oz
Yo�
o�
9(
(�
o+
(�
o�
oa9�o�
(+~f%-&~e�js�
%�f(+o�
(+~g%-&~e�ks�
%�g(+-W-So�
(+(+,:~Ho�
(�
�%o�
(g
�(Q
(�
oc90o�
(+~h%-&~e�ls�
%�h(+o�
8�o�
o\
t4oi
o7
r�Bp(h
:�oZ
t)o�
�(�
(�
,.+"oI
r�.po-
,+6o�
-�+'oZ
t)o�
o7
o$
r�.po-
,~IoM
(
+(Q
(�
o.
:����,o/
� o.
:^���� , o/
�*AdZj�*����.��(T
*0sr�Bpr�BprCpr�(pr�Bp(�U%r)<p�sV
�HrDprDprDpr�$prDp(�U%r)<p�sV
�I*03{�
o�
,o�
*o�
{�
s�
o�
**Js�
}�
(
*(
*6{K(*.sU�N*(
*0to�
o�
(.*~L%-&�sX
%�L�d% �!�o+~M%-&�sX
%�M�d% �"�o+*(
*6{Uo-
*.sZ�Z*(
*Zod
o7
r�Epo-
*0oe
of
(g
r�Ep(h
*0?~Aoe
of
(g
(+-oe
of
(g
r�6p(h
**.s_�_*(
*0Ao�
o�
rm#p(h
,o�
o�
r&po-
-o7
r�Epo-
**{a*"}a*{b*"}b*{c*"}c*Jr�p}c(
*.si�e*(
*Zod
o7
r�Epo-
*0oe
of
(g
r�Ep(h
*0?oZ
u)
,.oe
of
(g
r�.p(h
,o\
u4�**:(
}�
*{�
*BSJBv4.0.30319l�#~48#Stringsl7<F#US�}#GUID�}�#BlobW� �3*inH��
**�f� f����f
l
s
8
�
0
M
Y
���f� ������
1�
Z�
��c�_��
��#[W
�
�f���������
������
�
9
�~
��:[����L�k�-���)
��=�M
��V�D
�����
$
����&�o���������N�����P��
��[L
� �f
�
-�
��
���[�
4�
����
FU��|
��
�UH�u�t�)�[����������U�
�������
��
��
����
��
����
�
���s
I�fIS fI�fI��7U��7U<
7U
��7U
� 7U
��7U&
-
7U(�@7U+�/7U,�7�-��1:�4��6$��9*#�:/��<6�@=��BB��HJ�UJO$UKR�0ULT!WUNT�0UPW�0UQW�0USW�0UTW�UUW�0UVY�0UYY!WUZY�0U^^!WU_^-Uaa�0Udh!WUeh�Uim&�`
&� d
&Ug
6ej
6Nj
6.j
6�j
6&q
6Gy
!��!j�!M�V��V�#
�V���V���V�M�V��V��V���V�z�V��
�V�F�V�6�V��V�n�V��
�V�,�V�8�V���V�t�V��V�W�V�[�V���V���V�s�6&�
6��
!��!��!�Q��1g�
>g
V��
V� �
V���
1�
1��
1��
1
�
1��
1h�
1~�
1P�
1�
1
�
1Q�
1��
1��
1+�
1��
1
�
1V�
1��
1��
1>�
1
�
1e�
1j�
1��
1��
!��
k�
w
�
6�
9�
V�
��
��
�
��
u�� �
��
��
Y�
6�
9�
��
k�
��
6�
�
��3���
69�
��
k!�P ��X ��p �� ��� ��� ���!�s&L!���$��04$�!�<$���D$�W�L$�s7�$���o%��0�%�u��%�F��%�@��%�S��%�&A�%��A
'�b�'���+'�JA'�� T
x'��[`(�|
[)�ub�)���)���9*�JE*�� T�*�[[[+��d+���,�J ,�� T�,��[\-��[�-���-���].�Ji.�� T�.�
[�/���/���%0�J10�� Tp0��[|1��m �1��t!2��#2���#�2�J#�2�� T$d3�� [%�3��[&d5��['d6��(l6���(97�J(E7�� T)�7�^[*$9��+,9���+�9�J+�9�� T,�9��{-l:���.`=�W2�=�l�3P>��6X>���6�@�J6�@�� T7A��{8\E��9dE���9�E��9#F���;%F��;8F��;@F���;NF���<ZF��<dF�B�<�F��=�F��y=�F���>G��>G�p�>(G���?TG���@�G���A�G��A�G��AH���B H��BH�\�CH�k�C#H��
�D+H��
D4H��EGH���ESH��E[H�U�EtH���F�H�t�G�H���H�H�� �I6�g�OI���>>>>��>>>>>>>>>��>>>>>>>>>�.�����>>���o�XTTU� � � XTU� ���
)�1�9�A�I�Q�Y�a�i�q�y�������!�!���9(0?�9G��e�~�$���$���9���,�~4�<��4�<��������D�L���OT�a\��Sq�G
��yya�i+�~d�~l��
��i��J����T
��0�l�L��L��9�9!�9�
t�9`
�A=����A�A�6a�Q���"Q]
(��/Q���5�{<iQ�(W��
� 9\Avj|� ~)�0�1���9���9-
��>��y��G�)F����1�1fA,��2����]�IQQ�W�����]��n��
yY���������������Q����a��i��f���Wi�n�e��
�-qu$qT
��m
)��]��1�PI]�y!d�r �!GQ�9���
yy6�y��� �Q�������1�6��a����9F
j9����
�9I3������a��Q����Q���9vj�a�Y� �1���#a)�"-��3�� ����Y��Q:q�q�q�
ADS�I��Yy[y�`��
�5fy��Kl��tq9}�D����1���9��2I3�9���I9�%��
��m
*� ~�0��W�{<$�,�a4��!Z<�D� ~L� �Tm�L��D��D���%����-
�1y��W�L�48+<J@eDzH�L�P�T�X�\�`�d�h
l p+ t: xI |X �g �v �� �� �� �� �� �Q
�V
�[
$7'*�)7.�.�.
.#.+C.3�.;�.C�.K�.S�
.[�
.c�
.k�
.s�
.{,C�V
C
V
S�c�V
c
V
c�\��V
�
V
�������V
�
V
����"7�=�"7�=�CC"�= C#"7#=$�)C@"7@�V
A7A�V
C"7C=IC`�V
a�V
c"7c=d�iC��V
��V
�"7�=�C�C�"7�=�C�"7�=�C�C�V
"7=�� �V
#"7#=#��@�V
C"7C=C��c"7c=c��dC�"7�=����"7�=����"7�=����C�"7�=���"7=��#=C�V
DCc�V
��V
��V
�C��V
��V
�V
#�V
$�C�V
c�V
dC��V
��V
�C��V
�=�V
�V
C!�V
#�V
A�V
C=dC�CA Na =� =� =� =� C
=!
=A
=a
=�
=�
=�
=�
="==!=A=`"=a=�"=�=�"=�=�=�="== �V
!�V
@�V
A�V
`�V
a�V
��V
�=��V
�=��V
�=�=
=!
�V
@
"=`
"=�
"=�
�V
S�/�Bq�=gt.x~����v�A�h��
'*%���[�y�J�D�����������o��
�� �
$*/6=BJa!b!c#d#e%f%n'9w�����Yj���v������H,PYa���?IRv����7�����
�U !"#$%&'()*2�2� T�T� )5-5/q;�/�;�y��5�������c5���&&!&}��9�9!���5<>9__10_0<AnalyzeXamlFile>b__10_0<>c__DisplayClass1_0<>9__5_0<Initialize>b__5_0<AnalyzeCompilation>b__5_0<AnalyzeClass>b__5_0<>c__DisplayClass5_0<Detect>b__0<AnalyzeAssignment>b__0<>9__5_1<AnalyzeCompilation>b__5_1<AnalyzeClass>b__5_1IEnumerable`1Action`1IEqualityComparer`1IEnumerator`1ImmutableHashSet`1SeparatedSyntaxList`1ImmutableArray`1<>9__5_2<AnalyzeCompilation>b__5_2<AnalyzeClass>b__5_2Func`2ConditionalWeakTable`2ConditionalWeakTableLite`2ImmutableDictionary`2get_HasWebView2set_HasWebView2<>9<Module>GreenfieldWinUI<>OSystem.IOvalue__get_Areaareama<>cSystem.Collections.GenericReportDiagnosticdiagnosticIdMissingAutomationIdGetOrAdd<HasWebView2>k__BackingField<Area>k__BackingField<UwpQualifiedName>k__BackingField<Note>k__BackingField<Value>k__BackingField<XamlPath>k__BackingField<LearnAnchor>k__BackingField<WinAppSdkReplacement>k__BackingField<HasTabView>k__BackingField<UwpNamespacePrefix>k__BackingFieldget_EndProjectKindSyntaxKindnetstandardReplaceget_ContainingNamespaceUwpXamlNamespaceXBindMissingModeget_NodeCSharpSyntaxNodeSyntaxTreeResetCacheInvokeIEnumerableIDisposable_tableSystem.Collections.ImmutableToImmutableAnalyzeXamlFilefileMissingAutomationIdRuleNestedXBindRuleUwpNamespaceRuleXBindNoModeRuleMappingMatchRuleCoreDispatcherRuleNullConverterRuleTokenizerStreamCtorRuleSetInputSequencesRuleComputeLogitsRuleWebView2NoInitRuleWindowCurrentRuleTabViewRawContentRuleFeatureHintRuleMappingNoEquivRuleGetForCurrentViewRuleOldSyntaxRuleXNameget_Nameget_UwpQualifiedNameuwpQualifiedNameByQualifiedNameget_NamespaceNameGetFileNamecreatedTypeNameGetTypeNameget_LocalNameRuntimeTextLineget_Typeget_BaseTypeOfTypeget_ContainingTypeIsTabViewItemTypetypeWhereDetectCoreCaptureBaseget_OrdinalIgnoreCaseDisposeParseCreateget_NotenoteXAttributeAssemblyMetadataAttributeEmbeddedAttributeCompilerGeneratedAttributeAttributeUsageAttributeNeutralResourcesLanguageAttributeDebuggableAttributeNullableAttributeAssemblyTitleAttributeTargetFrameworkAttributeAssemblyFileVersionAttributeAssemblyInformationalVersionAttributeAssemblyConfigurationAttributeAssemblyDescriptionAttributeInternalsVisibleToAttributeDiagnosticAnalyzerAttributeRefSafetyRulesAttributeCompilationRelaxationsAttributeAssemblyProductAttributeAssemblyCopyrightAttributeNullableContextAttributeAssemblyCompanyAttributeRuntimeCompatibilityAttributeByteTValueget_ValueTryGetValuevalue<0>__AnalyzeUsingDirectiveInitializeLastIndexOfFlagSystem.ThreadingSystem.Runtime.VersioningFeatureMappingApiMappingToFullStringToStringToDisplayStringSubstring<1>__AnalyzeUsingApiMappingMatchMathget_Pathget_FilePathget_XamlPathset_XamlPathget_LengthEndsWithStartsWithXBindNestedNoFallbackget_SemanticModelGetSemanticModelAllMicrosoft.WindowsAppSDK.Analyzers.dllSystem.XmlWebView2NoInitXamlTabViewRawContentXamlISymbolget_SymbolINamespaceSymbolITypeSymbolINamedTypeSymbolget_Itemset_ItemSystemTrimEnumMvvmget_SpanGetLinePositionSpanTextSpanget_CancellationTokenSyntaxTokenMinGetFileNameWithoutExtensionVersionget_ExpressionCreateLocationGetLocationlocation<0>__AnalyzeInvocation<1>__AnalyzeObjectCreationget_Compilation<0>__AnalyzeCompilationcompilationget_Declaration<0>__AnalyzeFieldDeclarationMigrationRegisterSyntaxNodeActionRegisterCompilationActionRegisterCompilationStartActionSystem.ReflectionTextLineCollectionMatchCollectionGroupCollectionget_LinePositionEnableConcurrentExecutionStringComparisonUnknownIXmlLineInfoHasLineInfoGetTypeInfoXamlInfoGetSymbolInfoget_ZeroInteropMicrosoft.CodeAnalysis.CSharpBuildLookupGroupMigratingFromUwpSystem.Xml.LinqSystem.LinqClearCharget_LineNumberCreateBuilderCoreDispatcherget_Identifier<2>__AnalyzeIdentifierIsEventHandlerXContainerStringComparerNullConverterget_Initializer<0>__AnalyzeObjectInitializerAttachedPropertyInitializerDiagnosticAnalyzerXamlCodeBehindAnalyzerApiMappingAnalyzerGenAiApiAnalyzerUwpApiAnalyzerXamlAnalyzerMvvmPatternAnalyzerWebView2InitAnalyzerTabViewContentAnalyzerAttachedPropertyAnalyzerForget_LearnAnchorlearnAnchorGenAiTokenizerStreamCtorIEnumeratorGetEnumerator.ctor.cctorDiagnosticDescriptorbindExprSystem.DiagnosticsMicrosoft.CodeAnalysis.Diagnosticsget_SupportedDiagnosticsDiagnosticIdsUwpXamlNamespaceFalseFriendsFromBoundsWebView2MethodsSystem.Runtime.CompilerServicesGenAiSetInputSequencesSystem.ResourcesDebuggingModesDescendantNodesget_SyntaxTreesMatchesDiagnosticCategoriesget_Variablesget_AdditionalFilesMicrosoft.WindowsAppSDK.Analyzers.Rulesget_LinesWindowCurrentSafeTypesGetForCurrentViewSafeTypesWebView2RequiredContainingTypesAttachedPropertyTypesget_AttributesNullableFlagsGeneratedCodeAnalysisFlagsFeatureMappingsApiMappingsMicrosoft.CodeAnalysisConfigureGeneratedCodeAnalysisHelpLinksEqualsProblematicControlsInteractiveControlsContainsModelExtensionsCSharpExtensionsget_ExpressionsSystem.Text.RegularExpressionsSystem.Collectionsget_OptionsLoadOptionsAnalyzerOptionsRegexOptionsoptionsget_Groupsget_CharsMicrosoft.WindowsAppSDK.Analyzers<0>__AnalyzeClass<0>__AnalyzeMemberAccess<1>__AnalyzeMemberAccessAttributeTargetsGenAiComputeLogitsDescendantsget_AttributeListsAllowlistsConcatget_FullyQualifiedFormatSymbolDisplayFormatObjectDetectImmutableHashSetget_Leftget_RightSplitWebView2NoInitFirstOrDefaultToUpperInvariantToLowerInvariantget_WinAppSdkReplacementwinAppSdkReplacementXElementelement<0>__AnalyzeAssignmentXDocumentget_Parentget_CurrentWindowCurrentTabViewRawContentcontentFeatureMappingHintget_CountGetRootget_StartTrimStartstartTryReportMoveNextMicrosoft.CodeAnalysis.Textget_TextSourceTextsourceTextAdditionalTextGetTextSyntaxNodeAnalysisContextCompilationAnalysisContextCompilationStartAnalysisContextProjectContextcontextApiMappingNoEquivinvget_HasTabViewset_HasTabViewGetForCurrentViewMicrosoft.CodeAnalysis.CSharp.SyntaxQualifiedNameSyntaxSimpleNameSyntaxIdentifierNameSyntaxBaseTypeSyntaxAttributeSyntaxUsingDirectiveSyntaxOldMvvmSyntaxInvocationExpressionSyntaxBaseObjectCreationExpressionSyntaxInitializerExpressionSyntaxMemberAccessExpressionSyntaxAssignmentExpressionSyntaxBaseFieldDeclarationSyntaxVariableDeclarationSyntaxBaseTypeDeclarationSyntaxMemberDeclarationSyntaxClassDeclarationSyntaxVariableDeclaratorSyntaxAttributeListSyntaxXBindRegexget_UwpNamespacePrefixuwpNamespacePrefixByNamespacePrefixBoxImmutableArrayTKeykeyAnyImmutableDictionaryfactoryop_Equalityop_InequalityCompatibilityDiagnosticSeverityIsNullOrEmpty3ConnectedAnimationServiceiMicrosoft.UI.Xaml.Controls.ConnectedAnimationService/Contoso.Windows.UI.XamlWebView2GMicrosoft.UI.Xaml.Controls.WebView25Windows.UI.Core.CoreWindowAMicrosoft.UI.Windowing.AppWindow!guides/windowing]Windows.UI.Core.CoreWindow.GetForCurrentThreadCWindows.UI.Core.CoreWindow.BoundsKMicrosoft.UI.Windowing.AppWindow.SizeGWindows.UI.Core.CoreWindow.ActivateKMicrosoft.UI.Windowing.AppWindow.ShowKWindows.UI.Core.CoreWindow.DispatcherQMicrosoft.UI.Xaml.Window.DispatcherQueueSWindows.UI.ViewManagement.ApplicationViewcWindows.UI.ViewManagement.ApplicationViewTitleBarQMicrosoft.UI.Windowing.AppWindowTitleBarKWindows.UI.WindowManagement.AppWindowwWindows.ApplicationModel.Core.CoreApplication.CreateNewViewOMicrosoft.UI.Windowing.AppWindow.Create=Windows.UI.Core.CoreDispatcherQMicrosoft.UI.Dispatching.DispatcherQueue!guides/threadingOWindows.UI.Core.CoreDispatcher.RunAsyncgMicrosoft.UI.Dispatching.DispatcherQueue.TryEnqueue-Windows.UI.Composition1Microsoft.UI.CompositionWindows.UI.Xaml#Microsoft.UI.XamlOWindows.ApplicationModel.Resources.CoreYMicrosoft.Windows.ApplicationModel.Resourcesguides/mrtcore��Windows.ApplicationModel.Resources.Core.ResourceContext.GetForCurrentView��Microsoft.Windows.ApplicationModel.Resources.ResourceManager.CreateResourceContext��guides/mrtcore#resourcecontextgetforcurrentview-and-resourcecontextgetforviewindependentuseWindows.ApplicationModel.Resources.Core.ResourceManager.Current��new Microsoft.Windows.ApplicationModel.Resources.ResourceManager()Iguides/mrtcore#resourcemanager-classsWindows.ApplicationModel.Background.BackgroundTaskBuilder��Microsoft.Windows.ApplicationModel.Background.BackgroundTaskBuilderA../applifecycle/background-tasksyWindows.ApplicationModel.Activation.LaunchActivatedEventArgsUMicrosoft.UI.Xaml.LaunchActivatedEventArgssWindows.ApplicationModel.Core.CoreApplicationViewTitleBarOWindows.UI.Core.SystemNavigationManagercase-study-1��Windows.UI.ViewManagement.AccessibilitySettings.HighContrastChangedSMicrosoft.UI.System.ThemeSettings.ChangedMWindows.Storage.Pickers.FileOpenPickeraMicrosoft.Windows.Storage.Pickers.FileOpenPickerMguides/winui#messagedialog-and-pickersMWindows.Storage.Pickers.FileSavePickeraMicrosoft.Windows.Storage.Pickers.FileSavePickerIWindows.Storage.Pickers.FolderPicker]Microsoft.Windows.Storage.Pickers.FolderPicker?Windows.UI.Popups.MessageDialog��Microsoft.UI.Xaml.Controls.ContentDialog + IInitializeWithWindowwWindows.Security.Authentication.Web.WebAuthenticationBrokerkMicrosoft.Security.Authentication.OAuth.OAuth2Manager1/develop/security/oauth2KWindows.Media.Capture.CameraCaptureUI_Microsoft.Windows.Media.Capture.CameraCaptureUIMWindows.Graphics.Printing.PrintManagerKWindows.System.Display.DisplayRequestYWindows.UI.Text.Core.CoreTextServicesManagerWindows 11 onlysWindows.UI.Core.SystemNavigationManager.GetForCurrentViewGWindows.ApplicationModel.Background!Background tasks��WinAppSDK uses a Full-trust COM background-task model. See guides/background-task-migration-strategy.Windows.UI.Core/Windowing & dispatching��CoreWindow �! AppWindow, CoreDispatcher �! DispatcherQueue. See guides/windowing and guides/threading.7Windows.UI.WindowManagementWindowing��AppWindow has been redesigned in WinAppSDK. See guides/windowing.WinUI 3��All Windows.UI.Xaml namespaces move to Microsoft.UI.Xaml. See guides/winui.Composition��Windows.UI.Composition �! Microsoft.UI.Composition (all subnamespaces).EWindows.ApplicationModel.ResourcesResources / MRTGMRT �! MRT Core. See guides/mrtcore.Windows.Web.UIWebView��WebView (UWP) �! WebView2 (Microsoft.Web.WebView2). EnsureCoreWebView2Async required.GWindows.Security.Authentication.WebOAuth��WebAuthenticationBroker �! OAuth2Manager (WinAppSDK 1.7+). See develop/security/oauth2.��https://github.com/microsoft/WindowsAppSDK-Analyzers/blob/main/RULES.md#GWindows.ApplicationModel.Activation)Package.appxmanifestxmlns:uap=Windows.10global::.'see migration guideWUI1001MUWP API has Windows App SDK equivalent{0} �! {1}WinUI.Migration�Migrating from UWP to Windows App SDK: this UWP API has a documented WinAppSDK equivalent. Replace per the Microsoft Learn API mapping table.WUI1002SUWP API has no Windows App SDK equivalent[{0} is not supported in Windows App SDK ({1})��This UWP API has no direct equivalent in Windows App SDK. You may need to redesign the affected functionality before migrating.WUI1010oUWP feature area has Windows App SDK migration guidance{0} ({1}): {2}��Migration hint based on Microsoft Learn feature mapping table. Informational only.AutomationIdWUI2030IAttached property object initializer��'{0}' is an attached property cannot use object initializer syntax. Use {0}.Set{1}(element, value) insteadWinUI.Runtime�'WinUI attached properties (AutomationProperties, Grid, Canvas, ToolTipService, etc.) must be set via static methods, not object initializer syntax.)AutomationPropertiesToolTipServiceScrollViewer
Canvas GridRelativePanel+VariableSizedWrapGrid#SetInputSequencesComputeLogitsTokenizerStream!.TokenizerStreamWUI4101IRemoved GenAI API: SetInputSequences�=SetInputSequences was removed in OnnxRuntimeGenAI 0.6.0 use generator.AppendTokenSequences(sequences) instead (input goes on Generator, not GeneratorParams)WinUI.InteropWUI4102ARemoved GenAI API: ComputeLogits��ComputeLogits was removed in OnnxRuntimeGenAI 0.6.0 remove this call, GenerateNextToken() handles logits internallyWUI4103]Removed GenAI API: TokenizerStream constructor��new TokenizerStream(tokenizer) was removed in OnnxRuntimeGenAI 0.6.0 use tokenizer.CreateStream() instead%ObservableProperty7ObservablePropertyAttributeWUI3001KOld field-backed [ObservableProperty]�EField-backed [ObservableProperty] is the old CommunityToolkit.Mvvm 8.2 pattern use partial property: [ObservableProperty] public partial {0} {1} {{ get; set; }}WinUI.Mvvm�CThe field-backed [ObservableProperty] generates AOT compatibility warnings (MVVMTK0045). Use the partial property syntax available in CommunityToolkit.Mvvm 8.3+.ContenttabTabViewItemWUI2001=Raw control as TabView content�TabView does not stretch child controls vertically '{0}' will render at ~50px height. Use Frame.Navigate(typeof(Page)) per tab.��TabViewItem.Content should use a Frame navigating to Page types, not raw controls like TextBox or Grid. TabView's internal ContentPresenter uses StackPanel-like sizing that doesn't propagate stretch alignment.TextBoxRichEditBoxStackPanelListViewTreeView
BorderCurrent
Window5Application.Current.Window#GetForCurrentViewCoreDispatcherWUI0001/UWP XAML namespace used��Windows.UI.Xaml is the UWP namespace use Microsoft.UI.Xaml for WinUI 3'WinUI.CompatibilityWUI00025Window.Current is UWP-only��Window.Current does not exist in WinUI 3 desktop apps store the Window reference in App.xaml.csWUI00035CoreDispatcher is UWP-only��CoreDispatcher is UWP-only use DispatcherQueue.TryEnqueue() in WinUI 3WUI0004;GetForCurrentView is UWP-only��{0}.GetForCurrentView() is UWP-only use HWND-based COM interop in WinUI 3CoreWebView2webviewcorewebviewWUI4001IWebView2 used without initialization��'{0}' called but no EnsureCoreWebView2Async() found in this class WebView2 will silently fail�9WebView2.NavigateToString() and CoreWebView2 property access silently fail if EnsureCoreWebView2Async() hasn't completed. Always await initialization first.!NavigateToStringNavigate-PostWebMessageAsString)PostWebMessageAsJson%ExecuteScriptAsync.xamlApp.xaml%Converter={x:Null})Converter="{x:Null}"Mode=CommandConverter(FallbackValue,WUI2010GNested x:Bind without FallbackValue��Nested x:Bind path '{0}' will crash if any segment is null at startup add FallbackValue or use a flat ViewModel propertyCompilationEndWUI2020QInteractive control missing AutomationId��<{0}> has no AutomationProperties.AutomationId UI automation targeting will be unreliableWUI2012KConverter={x:Null} crashes at runtime�%Converter={{x:Null}} is not a valid converter it crashes with 'Resource Dictionary Key can only be String-typed'. Use an x:Bind function insteadWUI2011'x:Bind without Mode��x:Bind defaults to OneTime UI will not update after initial load. Add Mode=OneWay or Mode=TwoWay
ButtonRepeatButtonToggleButtonHyperlinkButtonDropDownButtonSplitButton#ToggleSplitButtonPasswordBoxNumberBoxAutoSuggestBoxComboBoxCheckBoxRadioButtonToggleSwitch
SliderRatingControlGridView%NavigationViewItemMenuBarItemMenuFlyoutItem%CalendarDatePickerDatePickerTimePickerColorPicker)\{x:Bind\s+([^}]+)\}TabView.xaml.csFrameWUI4002mWebView2 in XAML without initialization in code-behind��XAML declares <WebView2> but code-behind '{0}' has no EnsureCoreWebView2Async() call NavigateToString will silently failWUI2002_TabView in XAML with raw content in code-behind�XAML declares <TabView> but code-behind assigns raw control as tab content TabView doesn't stretch child controls. Use Frame+Page per tab/EnsureCoreWebView2Async/CoreWebView2InitializedCAutomationProperties.AutomationId����L����"�u M Y
YYYe i e
] ii e
a]
e0i00
0]0i0e0
0 h ��m< dm< �� uy}i��]���� �ey�ey uuy �I} ]��]��i�� �m �!}]
�� �q���� ������������ �I �M }
���M�I} �� ���y �y ����i00 ��
������ �� a ��]����0����
������������ ���� ��
��������
�e��
���e��
������������ �� ��
�� �
8
������������������������
�������� ������
������ ����� ��
�������� �����������}� ���e��
� �M��} �������]�� ����}��
���M��} ��������}�� �� �u�����}� �� �e�I���I
�� ����
�� �����e�e���e��u����� ���i��]�����! q1�%u�)�)��u�-�-���1�����5 �%��
�e�)�e�)u�) ��
�e�- ���-
�-�e�-u�- �� �1 �� �� �9�=�A�A �� �= �A�A ���A���A���� ���� ��
]c�E��i��]�����!�%��u�)�)uyy���I�M���u�����}� � �E���% m �My
� �����e��u��
� �M�I}
��d�������� �� �� ��
�e�����{��-�Q�?_�
:1�8V�6N5&WinUI.CompatibilityWinUI.MigrationWinUI.RuntimeWinUI.MvvmWinUI.InteropWUI0001WUI0002WUI0003WUI0004WUI1001WUI1002WUI1010WUI2001WUI2002WUI2010WUI2011WUI2012WUI2020WUI2030WUI3001WUI4001WUI4002WUI4101WUI4102WUI4103��https://github.com/microsoft/WindowsAppSDK-Analyzers/blob/main/RULES.mdY] a ]0a0 dm<<�����q ����p ������
����
���� �����
���-��
���� a a0<mq ]�� ����
������
�
����!�����!�) <m �� �� �� �- ��( (]��((TWrapNonExceptionThrows,'Microsoft.WindowsAppSDK.Analyzers.TestsG.NETStandard,Version=v2.0TFrameworkDisplayName.NET Standard 2.0 MicrosoftRelease3.© Microsoft Corporation. All rights reserved.����Roslyn analyzers for WinUI 3 / Windows App SDK apps. Catches UWP→WinUI compatibility issues, runtime pitfalls, MVVM regressions, and interop bugs at build time.1.0.0.03.1.0.0+42e3d6956818f9e83fc53379f0172b80e947516b&!Microsoft.WindowsAppSDK.Analyzers>
RepositoryUrl+https://github.com/microsoft/win-dev-skills
en-US
&�kT
AllowMultipleT Inherited<
AllowMultipleT Inherited&T
AllowMultipleT InheritedC#p��MP�����'����RSDS�FH1�hG�k����"�D:\win-dev-skills\src\tools\winui-analyzer\Microsoft.WindowsAppSDK.Analyzers\obj\Release\netstandard2.0\Microsoft.WindowsAppSDK.Analyzers.pdbSHA256�FH1�h'yk����"�p��J�B���b�Q�#��� ��_CorDllMainmscoree.dll�% �0�HX���4VS_VERSION_INFO���?DVarFileInfo$Translation��StringFileInfo�000004b0Z�CommentsRoslyn analyzers for WinUI 3 / Windows App SDK apps. Catches UWP�!WinUI compatibility issues, runtime pitfalls, MVVM regressions, and interop bugs at build time.4
CompanyNameMicrosoftl"FileDescriptionMicrosoft.WindowsAppSDK.Analyzers0FileVersion1.0.0.0l&InternalNameMicrosoft.WindowsAppSDK.Analyzers.dll�.LegalCopyright� Microsoft Corporation. All rights reserved.t&OriginalFilenameMicrosoft.WindowsAppSDK.Analyzers.dlld"ProductNameMicrosoft.WindowsAppSDK.Analyzers�/ProductVersion1.0.0+42e3d6956818f9e83fc53379f0172b80e947516b8Assembly Version1.0.0.0� 7<Project>
<!--
Auto-inject XAML files as AdditionalFiles so the WinUI analyzer can inspect them.
Runs before CoreCompile so .xaml files surface in AnalyzerOptions.AdditionalFiles
inside the rule analyzers.
-->
<Target Name="WindowsAppSDKAnalyzersInjectXamlFiles" BeforeTargets="CoreCompile">
<ItemGroup>
<AdditionalFiles Include="@(Page)" Condition="'%(Extension)' == '.xaml'" />
<AdditionalFiles Include="@(ApplicationDefinition)" Condition="'%(Extension)' == '.xaml'" />
</ItemGroup>
</Target>
</Project>
<#
.SYNOPSIS
Builds and optionally runs a WinUI 3 / .NET project.
.DESCRIPTION
One command to build and run: .\BuildAndRun.ps1 MyApp.csproj
- Checks Developer Mode is enabled (required for packaged WinUI apps)
- Auto-detects platform (x64/ARM64), defaults to Debug, auto-restores
- Finds MSBuild via vswhere, falls back to dotnet build
- After successful build, finds the output folder and runs with winapp run
- Pass -SkipRun to build without launching
.EXAMPLE
.\BuildAndRun.ps1 MyApp.csproj # Build + run
.\BuildAndRun.ps1 MyApp.csproj -SkipRun # Build only
.\BuildAndRun.ps1 MyApp.csproj /p:Configuration=Release # Override config
#>
param(
[Parameter(Position = 0)]
[string]$Project,
[switch]$SkipRun,
[switch]$Detach,
[Parameter(ValueFromRemainingArguments)]
[string[]]$ExtraArgs
)
$ErrorActionPreference = 'Stop'
# Accept --detach (CLI style) as an alias for -Detach (PS style)
if ($ExtraArgs -contains '--detach') {
$Detach = $true
$ExtraArgs = $ExtraArgs | Where-Object { $_ -ne '--detach' }
}
# Extra args are MSBuild-style flags like /p:Platform=x64
$extraArgs = $ExtraArgs
# -- 0. Check Developer Mode --
$devMode = $false
try {
$regPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock"
if (Test-Path $regPath) {
$val = Get-ItemProperty $regPath -Name AllowDevelopmentWithoutDevLicense -ErrorAction SilentlyContinue
if ($val.AllowDevelopmentWithoutDevLicense -eq 1) { $devMode = $true }
}
} catch {}
if (-not $devMode) {
Write-Host "ERROR: Developer Mode is not enabled." -ForegroundColor Red
Write-Host "WinUI 3 packaged apps require Developer Mode to deploy and run." -ForegroundColor Red
Write-Host "Enable it: Settings > System > For developers > Developer Mode" -ForegroundColor Yellow
exit 1
}
# -- 1. Find the .csproj if not specified --
if (-not $Project) {
$csprojFiles = Get-ChildItem -Path . -Filter "*.csproj" -Depth 0
if ($csprojFiles.Count -eq 1) {
$Project = $csprojFiles[0].Name
} elseif ($csprojFiles.Count -gt 1) {
Write-Error "Multiple .csproj files found. Specify which one: .\BuildAndRun.ps1 <name>.csproj"
exit 1
} else {
Write-Error "No .csproj file found in current directory."
exit 1
}
}
# -- 2. Auto-detect platform --
$detectedPlatform = if ($env:PROCESSOR_ARCHITECTURE -eq "ARM64") { "ARM64" } else { "x64" }
$detectedConfig = "Debug"
$hasPlatform = $extraArgs | Where-Object { $_ -match "^[/|-]p:Platform=" }
$hasConfig = $extraArgs | Where-Object { $_ -match "^[/|-]p:Configuration=" }
$hasRestore = $extraArgs | Where-Object { $_ -match "^[/|-]restore$|^[/|-]t:restore$|^--restore$" }
# Extract actual values if overridden
if ($hasPlatform -and $hasPlatform -match "Platform=(\w+)") { $detectedPlatform = $Matches[1] }
if ($hasConfig -and $hasConfig -match "Configuration=(\w+)") { $detectedConfig = $Matches[1] }
$autoArgs = @()
if (-not $hasPlatform) { $autoArgs += "/p:Platform=$detectedPlatform" }
if (-not $hasConfig) { $autoArgs += "/p:Configuration=$detectedConfig" }
if (-not $hasRestore) { $autoArgs += "/restore" }
# -- 3. Find build tool --
$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
$msbuild = $null
if (Test-Path $vswhere) {
$vsPath = & $vswhere -latest -requires Microsoft.Component.MSBuild -property installationPath 2>$null
if ($vsPath) {
$candidate = Join-Path $vsPath "MSBuild\Current\Bin\MSBuild.exe"
if (Test-Path $candidate) { $msbuild = $candidate }
}
}
# -- 4. Build --
$defaultArgs = @("/nologo")
$hasVerbosity = $extraArgs | Where-Object { $_ -match "^[/|-]v(erbosity)?:" }
if (-not $hasVerbosity) { $defaultArgs += "/v:m" }
# -- 4a. Inject Microsoft.WindowsAppSDK.Analyzers if available --
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
# Look for pre-built analyzer DLL in the skill folder first, then fall back to source tree
$analyzerDll = Join-Path $scriptDir "analyzer\Microsoft.WindowsAppSDK.Analyzers.dll"
$analyzerTargets = Join-Path $scriptDir "analyzer\Microsoft.WindowsAppSDK.Analyzers.targets"
if (-not (Test-Path $analyzerDll)) {
$analyzerDll = Join-Path $scriptDir "..\..\tools\winui-analyzer\Microsoft.WindowsAppSDK.Analyzers\bin\Release\netstandard2.0\Microsoft.WindowsAppSDK.Analyzers.dll"
$analyzerTargets = Join-Path $scriptDir "..\..\tools\winui-analyzer\Microsoft.WindowsAppSDK.Analyzers\Microsoft.WindowsAppSDK.Analyzers.targets"
}
$analyzerArgs = @()
$tempBuildProps = $null
if (Test-Path $analyzerDll) {
$analyzerDll = (Resolve-Path $analyzerDll).Path
$analyzerTargets = (Resolve-Path $analyzerTargets).Path
# Inject via temporary Directory.Build.props (works with both MSBuild and dotnet build)
$projectDir = Split-Path (Resolve-Path $Project) -Parent
if (-not $projectDir) { $projectDir = "." }
$tempBuildProps = Join-Path $projectDir "Directory.Build.props"
$existingProps = $null
if (Test-Path $tempBuildProps) {
$existingProps = Get-Content $tempBuildProps -Raw
}
# Only create if one doesn't already exist (don't overwrite user's file)
if (-not $existingProps) {
@"
<Project>
<ItemGroup>
<Analyzer Include="$analyzerDll" />
</ItemGroup>
<Import Project="$analyzerTargets" />
</Project>
"@ | Set-Content $tempBuildProps
Write-Host "--> Microsoft.WindowsAppSDK.Analyzers: enabled" -ForegroundColor DarkGray
} else {
$tempBuildProps = $null # Don't clean up a pre-existing file
Write-Host "--> Microsoft.WindowsAppSDK.Analyzers: skipped (existing Directory.Build.props)" -ForegroundColor DarkGray
}
}
Write-Host ""
try {
if ($msbuild) {
Write-Host "--> Building with MSBuild (Platform: $detectedPlatform, Config: $detectedConfig)" -ForegroundColor Cyan
Write-Host "--> MSBuild: $msbuild" -ForegroundColor DarkGray
$allArgs = $defaultArgs + $autoArgs + @($Project) + $extraArgs
& $msbuild $allArgs
$buildExit = $LASTEXITCODE
} else {
Write-Host "--> Building with dotnet build (Platform: $detectedPlatform, Config: $detectedConfig)" -ForegroundColor Yellow
$dotnetArgs = @($Project)
foreach ($a in ($autoArgs + $extraArgs)) {
if ($a -match "^[/|-]restore$|^[/|-]t:restore$") {
# dotnet build restores by default
} elseif ($a -match "^[/|-]p:(.+)$") {
$dotnetArgs += "-p:$($Matches[1])"
} elseif ($a -notmatch "\.(csproj|sln)$") {
$dotnetArgs += $a
}
}
& dotnet build @dotnetArgs
$buildExit = $LASTEXITCODE
}
}
finally {
# Always clean up the temp Directory.Build.props we created — even on
# Ctrl-C, throws, or unexpected exits. Otherwise the user's project
# gets a stray file pointing at our analyzer that subsequent vanilla
# `dotnet build` invocations will fail to resolve.
if ($tempBuildProps -and (Test-Path $tempBuildProps)) {
Remove-Item $tempBuildProps -Force -ErrorAction SilentlyContinue
}
}
if ($buildExit -ne 0) {
Write-Host ""
Write-Host "BUILD FAILED (exit code $buildExit)" -ForegroundColor Red
exit $buildExit
}
Write-Host ""
Write-Host "BUILD SUCCEEDED" -ForegroundColor Green
# -- 5. Run with winapp --
if ($SkipRun) {
Write-Host "--> Skipping run (-SkipRun)" -ForegroundColor DarkGray
exit 0
}
# Find the build output directory
$rid = $detectedPlatform.ToLower()
$projectDir = Split-Path (Resolve-Path $Project) -Parent
if (-not $projectDir) { $projectDir = "." }
# Search for the output folder pattern: bin\<Platform>\<Config>\<tfm>\win-<rid>\
$binDir = Join-Path $projectDir "bin\$detectedPlatform\$detectedConfig"
if (-not (Test-Path $binDir)) {
Write-Host "WARNING: Build output not found at $binDir -- skipping run" -ForegroundColor Yellow
exit 0
}
# Find the TFM folder (e.g., net10.0-windows10.0.26100.0)
$tfmDirs = Get-ChildItem $binDir -Directory | Where-Object { $_.Name -match "^net\d" }
if (-not $tfmDirs) {
Write-Host "WARNING: No TFM folder found in $binDir -- skipping run" -ForegroundColor Yellow
exit 0
}
$tfmDir = $tfmDirs | Sort-Object Name -Descending | Select-Object -First 1
$outputDir = Join-Path $tfmDir.FullName "win-$rid"
if (-not (Test-Path $outputDir)) {
# Try without RID subfolder
$outputDir = $tfmDir.FullName
}
# Check winapp is available
$winapp = Get-Command winapp -ErrorAction SilentlyContinue
if (-not $winapp) {
Write-Host "WARNING: winapp CLI not found in PATH -- skipping run" -ForegroundColor Yellow
Write-Host "Build output at: $outputDir"
exit 0
}
Write-Host ""
if ($Detach) {
Write-Host "--> Launching app in background..." -ForegroundColor Cyan
& winapp run $outputDir --detach --json
} else {
Write-Host "--> Launching app: winapp run $outputDir --debug-output" -ForegroundColor Cyan
Write-Host " The script will stay running while the app is open." -ForegroundColor DarkGray
Write-Host " Debug output and exceptions will appear below." -ForegroundColor DarkGray
Write-Host ""
& winapp run $outputDir --debug-output
}Related skills
FAQ
What does winui-dev-workflow produce?
A built and running WinUI app via BuildAndRun.ps1 and winapp run with diagnosed fixes for common errors.
When should I use winui-dev-workflow?
When building, running, scaffolding, or fixing build and launch errors in a WinUI 3 project.
Is winui-dev-workflow safe to install?
Review the Security Audits panel on this page before installing in production.