Demonstrates how to use WinUI 3 in Visual Basic .NET projects.
- No C# or C++ projects for startup
- Load
XamlControlsResources
fromMicrosoft.UI.Xaml.Controls
automatically - Use a custom
Sub Main
- You can enable high DPI, add dynamic dependencies or add reg-free WinRT support by editingProgram.vb
. - Allow Windows Forms integration, such as registering
HostServices.VBHost
at startup - Make sure Mica and Acrylic are working as expected on Windows 11
- Workaround blocking bugs of the WinUI 3 XAML compiler - Generate Xbf files and VB source files
- Workaround trivial bugs of the WinUI 3 XAML compiler - Generate 99% correct VB source files
- Publish a NuGet package that contains VB specific build transitive files, so any VB projects will be able to use WinUI 3 without editing
*.vbproj
manually. - Publish a VSIX to add VB WinUI 3 templates to Visual Studio.
- Write a new VB application framework for WinUI 3 - Allow users to delete
Program.vb
and use events to configure the App in theApplication
class - Write a new VB "My extension" for WinUI 3 - Enable
My.*
for WinUI 3 specific things
- Visual Studio 2022 with Windows Desktop and UWP development workloads
- Windows 10 21H2 or Windows 11
The MSBuild target files of WinUI 3 need some hacking to support Visual Basic. VB projects need to import the following target file to use WinUI 3.
WinUI3.VisualBasic.targets
<Project>
<PropertyGroup>
<!-- Workaround for conflicts with WPF -->
<ImportFrameworkWinFXTargets>true</ImportFrameworkWinFXTargets>
<!-- Workaround for wrong entry point code generated by WinUI 3 -->
<DefineConstants>DISABLE_XAML_GENERATED_MAIN</DefineConstants>
</PropertyGroup>
<!-- Workaround for XamlPreCompile compilation errors -->
<Target Name="SpecifyVBRuntimeForXamlPreCompile" BeforeTargets="XamlPreCompile">
<PropertyGroup>
<VBRuntime>None</VBRuntime>
</PropertyGroup>
</Target>
</Project>
Stopped with error. See [XamlLanguageConverter].
WIP. See [Custom XAML compiler].
A mp4
video to h265
transcoder.
It converts .mp4
and .mkv
videos to h265
encoding by calling H265.bat
.
Finished. Tested with WinUI3 v1.3.230602002
and .NET SDK v7.0.7.
- Install
ffmpeg
to%programfiles%\ffmpeg\bin
. If you have installed it in a different location, please add it to%PATH%
. - Open
BatchFfmpegWinUI.sln
with Visual Studio. - Set
BatchFfmpegWinUI_Pack
as startup project and run. - Drag and drop
.mp4
or.mkv
files. - Press the "Convert" button and wait.
Demonstrates how to use MSBuild extension points to invoke the C# XAML compiler and start a code converter to convert the C# output to VB.
Stopped with error. Because it has severe performance issues.
Use the XamlCompilerTaskPath
MSBuild property to replace the path of Microsoft.UI.Xaml.Markup.Compiler.dll
with a custom XAML compiler.
The source code of this part won't be published until Microsoft uploads the source code of Microsoft.UI.Xaml.Markup.Compiler
.
WIP
A VB version of WinUIGallery v1.1
. It uses the C# XAML converter until the official VB WinUI3 XAML converter works correctly.
WIP, depends on XamlLanguageConverter
.