Skip to content

Commit d480172

Browse files
authored
Replace WinUI3GetStarted 2020 project by result of latest project template (#257)
* Replace WinUI3 2020 project by result of latest * revert urlFragment * readme say updated date for Maint
1 parent 6bf4af5 commit d480172

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+271
-3194
lines changed

GettingStartedGuides/WinUI3_GettingStarted/README.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ urlFragment: WinUI3_GettingStarted
1010
# Get started with WebView2 in WinUI 3 (Windows App SDK) apps
1111

1212
<!-- only enough info to differentiate this sample vs the others; what is different about this sample compared to the sibling samples? -->
13-
This sample, **WinUI3_GettingStarted**, is the completed Visual Studio project that results from following the steps in the tutorial [Get started with WebView2 in WinUI 3 (Windows App SDK) apps](https://learn.microsoft.com/microsoft-edge/webview2/get-started/winui).
13+
This sample, **WinUI3GetStarted**, is the completed Visual Studio project that results from following the steps in the tutorial [Get started with WebView2 in WinUI 3 (Windows App SDK) apps](https://learn.microsoft.com/microsoft-edge/webview2/get-started/winui).
1414

15-
![The running app from the finished WinUI 3 (Windows App SDK) tutorial](screenshots/getting-started-part-3.png)
15+
![The running app from the finished WinUI 3 (Windows App SDK) tutorial](screenshots/finished-app.png)
16+
17+
Project updated Nov. 1, 2024.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.11.35327.3
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WinUI3GetStarted", "WinUI3GetStarted\WinUI3GetStarted.csproj", "{FBF1E5FC-C14D-4C2D-88D4-6B8B55821E52}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|ARM64 = Debug|ARM64
11+
Debug|x64 = Debug|x64
12+
Debug|x86 = Debug|x86
13+
Release|ARM64 = Release|ARM64
14+
Release|x64 = Release|x64
15+
Release|x86 = Release|x86
16+
EndGlobalSection
17+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
18+
{FBF1E5FC-C14D-4C2D-88D4-6B8B55821E52}.Debug|ARM64.ActiveCfg = Debug|ARM64
19+
{FBF1E5FC-C14D-4C2D-88D4-6B8B55821E52}.Debug|ARM64.Build.0 = Debug|ARM64
20+
{FBF1E5FC-C14D-4C2D-88D4-6B8B55821E52}.Debug|ARM64.Deploy.0 = Debug|ARM64
21+
{FBF1E5FC-C14D-4C2D-88D4-6B8B55821E52}.Debug|x64.ActiveCfg = Debug|x64
22+
{FBF1E5FC-C14D-4C2D-88D4-6B8B55821E52}.Debug|x64.Build.0 = Debug|x64
23+
{FBF1E5FC-C14D-4C2D-88D4-6B8B55821E52}.Debug|x64.Deploy.0 = Debug|x64
24+
{FBF1E5FC-C14D-4C2D-88D4-6B8B55821E52}.Debug|x86.ActiveCfg = Debug|x86
25+
{FBF1E5FC-C14D-4C2D-88D4-6B8B55821E52}.Debug|x86.Build.0 = Debug|x86
26+
{FBF1E5FC-C14D-4C2D-88D4-6B8B55821E52}.Debug|x86.Deploy.0 = Debug|x86
27+
{FBF1E5FC-C14D-4C2D-88D4-6B8B55821E52}.Release|ARM64.ActiveCfg = Release|ARM64
28+
{FBF1E5FC-C14D-4C2D-88D4-6B8B55821E52}.Release|ARM64.Build.0 = Release|ARM64
29+
{FBF1E5FC-C14D-4C2D-88D4-6B8B55821E52}.Release|ARM64.Deploy.0 = Release|ARM64
30+
{FBF1E5FC-C14D-4C2D-88D4-6B8B55821E52}.Release|x64.ActiveCfg = Release|x64
31+
{FBF1E5FC-C14D-4C2D-88D4-6B8B55821E52}.Release|x64.Build.0 = Release|x64
32+
{FBF1E5FC-C14D-4C2D-88D4-6B8B55821E52}.Release|x64.Deploy.0 = Release|x64
33+
{FBF1E5FC-C14D-4C2D-88D4-6B8B55821E52}.Release|x86.ActiveCfg = Release|x86
34+
{FBF1E5FC-C14D-4C2D-88D4-6B8B55821E52}.Release|x86.Build.0 = Release|x86
35+
{FBF1E5FC-C14D-4C2D-88D4-6B8B55821E52}.Release|x86.Deploy.0 = Release|x86
36+
EndGlobalSection
37+
GlobalSection(SolutionProperties) = preSolution
38+
HideSolutionNode = FALSE
39+
EndGlobalSection
40+
GlobalSection(ExtensibilityGlobals) = postSolution
41+
SolutionGuid = {1334E548-2468-4E8F-84AF-B2B85C674856}
42+
EndGlobalSection
43+
EndGlobal
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Application
3+
x:Class="WinUI3GetStarted.App"
4+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
5+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
6+
xmlns:local="using:WinUI3GetStarted">
7+
<Application.Resources>
8+
<ResourceDictionary>
9+
<ResourceDictionary.MergedDictionaries>
10+
<XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />
11+
<!-- Other merged dictionaries here -->
12+
</ResourceDictionary.MergedDictionaries>
13+
<!-- Other app resources here -->
14+
</ResourceDictionary>
15+
</Application.Resources>
16+
</Application>
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1-
using System;
1+
using Microsoft.UI.Xaml;
2+
using Microsoft.UI.Xaml.Controls;
3+
using Microsoft.UI.Xaml.Controls.Primitives;
4+
using Microsoft.UI.Xaml.Data;
5+
using Microsoft.UI.Xaml.Input;
6+
using Microsoft.UI.Xaml.Media;
7+
using Microsoft.UI.Xaml.Navigation;
8+
using Microsoft.UI.Xaml.Shapes;
9+
using System;
210
using System.Collections.Generic;
311
using System.IO;
412
using System.Linq;
@@ -7,17 +15,11 @@
715
using Windows.ApplicationModel.Activation;
816
using Windows.Foundation;
917
using Windows.Foundation.Collections;
10-
using Microsoft.UI.Threading;
11-
using Microsoft.UI.Xaml;
12-
using Microsoft.UI.Xaml.Controls;
13-
using Microsoft.UI.Xaml.Controls.Primitives;
14-
using Microsoft.UI.Xaml.Data;
15-
using Microsoft.UI.Xaml.Input;
16-
using Microsoft.UI.Xaml.Media;
17-
using Microsoft.UI.Xaml.Navigation;
18-
using Microsoft.UI.Xaml.Shapes;
1918

20-
namespace WinUI_Sample
19+
// To learn more about WinUI, the WinUI project structure,
20+
// and more about our project templates, see: http://aka.ms/winui-project-info.
21+
22+
namespace WinUI3GetStarted
2123
{
2224
/// <summary>
2325
/// Provides application-specific behavior to supplement the default Application class.
@@ -31,12 +33,10 @@ public partial class App : Application
3133
public App()
3234
{
3335
this.InitializeComponent();
34-
this.Suspending += OnSuspending;
3536
}
3637

3738
/// <summary>
38-
/// Invoked when the application is launched normally by the end user. Other entry points
39-
/// will be used such as when the application is launched to open a specific file.
39+
/// Invoked when the application is launched.
4040
/// </summary>
4141
/// <param name="args">Details about the launch request and process.</param>
4242
protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs args)
@@ -45,18 +45,6 @@ protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs ar
4545
m_window.Activate();
4646
}
4747

48-
/// <summary>
49-
/// Invoked when application execution is being suspended. Application state is saved
50-
/// without knowing whether the application will be terminated or resumed with the contents
51-
/// of memory still intact.
52-
/// </summary>
53-
/// <param name="sender">The source of the suspend request.</param>
54-
/// <param name="e">Details about the suspend request.</param>
55-
private void OnSuspending(object sender, SuspendingEventArgs e)
56-
{
57-
// Save application state and stop any background activity
58-
}
59-
6048
private Window m_window;
6149
}
6250
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Window
3+
x:Class="WinUI3GetStarted.MainWindow"
4+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
5+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
6+
xmlns:local="using:WinUI3GetStarted"
7+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
8+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
9+
xmlns:controls="using:Microsoft.UI.Xaml.Controls"
10+
mc:Ignorable="d">
11+
12+
<Grid>
13+
<Grid.RowDefinitions>
14+
<RowDefinition Height="Auto"/>
15+
<RowDefinition Height="*"/>
16+
</Grid.RowDefinitions>
17+
<Grid.ColumnDefinitions>
18+
<ColumnDefinition Width="*"/>
19+
<ColumnDefinition Width="Auto"/>
20+
</Grid.ColumnDefinitions>
21+
22+
<TextBox Name="addressBar" Grid.Column="0"/>
23+
<Button x:Name="myButton" Grid.Column="1" Click="myButton_Click">Go</Button>
24+
25+
<controls:WebView2 x:Name="MyWebView" Grid.Row="1" Grid.ColumnSpan="2"
26+
Source="https://www.microsoft.com" HorizontalAlignment="Stretch"
27+
VerticalAlignment="Stretch"/>
28+
</Grid>
29+
</Window>
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.IO;
4-
using System.Linq;
5-
using System.Runtime.InteropServices.WindowsRuntime;
6-
using Windows.Foundation;
7-
using Windows.Foundation.Collections;
1+
using Microsoft.Web.WebView2.Core;
82
using Microsoft.UI.Xaml;
93
using Microsoft.UI.Xaml.Controls;
104
using Microsoft.UI.Xaml.Controls.Primitives;
115
using Microsoft.UI.Xaml.Data;
126
using Microsoft.UI.Xaml.Input;
137
using Microsoft.UI.Xaml.Media;
148
using Microsoft.UI.Xaml.Navigation;
15-
using ABI.Microsoft.UI.Private.Controls;
9+
using System;
10+
using System.Collections.Generic;
11+
using System.IO;
12+
using System.Linq;
13+
using System.Runtime.InteropServices.WindowsRuntime;
14+
using Windows.Foundation;
15+
using Windows.Foundation.Collections;
1616

17-
// The Blank Window item template is documented at https://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409
17+
// To learn more about WinUI, the WinUI project structure,
18+
// and more about our project templates, see: http://aka.ms/winui-project-info.
1819

19-
namespace WinUI_Sample
20+
namespace WinUI3GetStarted
2021
{
2122
/// <summary>
2223
/// An empty window that can be used on its own or navigated to within a Frame.
@@ -27,17 +28,9 @@ public MainWindow()
2728
{
2829
this.InitializeComponent();
2930
MyWebView.NavigationStarting += EnsureHttps;
30-
//MyWebView.WebMessageReceived += UpdateAddressBar;
31-
3231
}
3332

34-
private void UpdateAddressBar(WebView2 sender, WebView2WebMessageReceivedEventArgs args)
35-
{
36-
//String uri = args.Source;
37-
//addressBar.Text = uri;
38-
}
39-
40-
private void EnsureHttps(WebView2 sender, WebView2NavigationStartingEventArgs args)
33+
private void EnsureHttps(WebView2 sender, CoreWebView2NavigationStartingEventArgs args)
4134
{
4235
String uri = args.Uri;
4336
if (!uri.StartsWith("https://"))
@@ -51,21 +44,17 @@ private void EnsureHttps(WebView2 sender, WebView2NavigationStartingEventArgs ar
5144
}
5245
}
5346

54-
55-
private void myButton_Click(object sender, RoutedEventArgs e)
47+
private void myButton_Click(object sender, RoutedEventArgs e)
5648
{
57-
//myButton.Content = "Clicked";
58-
5949
try
6050
{
6151
Uri targetUri = new Uri(addressBar.Text);
6252
MyWebView.Source = targetUri;
6353
}
6454
catch (FormatException ex)
6555
{
66-
// Bad address.
56+
// Incorrect address entered.
6757
}
68-
6958
}
7059
}
7160
}

GettingStartedGuides/WinUI3_GettingStarted/WinUI_Sample/WinUI_Sample (Package)/Package.appxmanifest GettingStartedGuides/WinUI3_GettingStarted/WinUI3GetStarted/WinUI3GetStarted/Package.appxmanifest

+16-14
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,27 @@
22

33
<Package
44
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
5+
xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"
56
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
67
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
78
IgnorableNamespaces="uap rescap">
89

910
<Identity
10-
Name="25f0d1c7-2470-49df-b58d-3c2650506b00"
11-
Publisher="CN=jasteph"
11+
Name="2f643296-f430-4d03-9877-c1d17530b600"
12+
Publisher="CN=v-mihoffman"
1213
Version="1.0.0.0" />
1314

15+
<mp:PhoneIdentity PhoneProductId="2f643296-f430-4d03-9877-c1d17530b600" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>
16+
1417
<Properties>
15-
<DisplayName>WinUI_Sample (Package)</DisplayName>
16-
<PublisherDisplayName>jasteph</PublisherDisplayName>
17-
<Logo>Images\StoreLogo.png</Logo>
18+
<DisplayName>WinUI3GetStarted</DisplayName>
19+
<PublisherDisplayName>v-mihoffman</PublisherDisplayName>
20+
<Logo>Assets\StoreLogo.png</Logo>
1821
</Properties>
1922

2023
<Dependencies>
21-
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.0.0" MaxVersionTested="10.0.0.0" />
22-
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.14393.0" MaxVersionTested="10.0.14393.0" />
24+
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.17763.0" MaxVersionTested="10.0.19041.0" />
25+
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.17763.0" MaxVersionTested="10.0.19041.0" />
2326
</Dependencies>
2427

2528
<Resources>
@@ -31,19 +34,18 @@
3134
Executable="$targetnametoken$.exe"
3235
EntryPoint="$targetentrypoint$">
3336
<uap:VisualElements
34-
DisplayName="WinUI_Sample (Package)"
35-
Description="WinUI_Sample (Package)"
37+
DisplayName="WinUI3GetStarted"
38+
Description="WinUI3GetStarted"
3639
BackgroundColor="transparent"
37-
Square150x150Logo="Images\Square150x150Logo.png"
38-
Square44x44Logo="Images\Square44x44Logo.png">
39-
<uap:DefaultTile Wide310x150Logo="Images\Wide310x150Logo.png" />
40-
<uap:SplashScreen Image="Images\SplashScreen.png" />
40+
Square150x150Logo="Assets\Square150x150Logo.png"
41+
Square44x44Logo="Assets\Square44x44Logo.png">
42+
<uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png" />
43+
<uap:SplashScreen Image="Assets\SplashScreen.png" />
4144
</uap:VisualElements>
4245
</Application>
4346
</Applications>
4447

4548
<Capabilities>
46-
<Capability Name="internetClient" />
4749
<rescap:Capability Name="runFullTrust" />
4850
</Capabilities>
4951
</Package>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
https://go.microsoft.com/fwlink/?LinkID=208121.
4+
-->
5+
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
6+
<PropertyGroup>
7+
<PublishProtocol>FileSystem</PublishProtocol>
8+
<Platform>ARM64</Platform>
9+
<RuntimeIdentifier Condition="$([MSBuild]::GetTargetFrameworkVersion('$(TargetFramework)')) >= 8">win-arm64</RuntimeIdentifier>
10+
<RuntimeIdentifier Condition="$([MSBuild]::GetTargetFrameworkVersion('$(TargetFramework)')) &lt; 8">win10-arm64</RuntimeIdentifier>
11+
<PublishDir>bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\</PublishDir>
12+
<SelfContained>true</SelfContained>
13+
<PublishSingleFile>False</PublishSingleFile>
14+
<PublishReadyToRun Condition="'$(Configuration)' == 'Debug'">False</PublishReadyToRun>
15+
<PublishReadyToRun Condition="'$(Configuration)' != 'Debug'">True</PublishReadyToRun>
16+
<PublishTrimmed Condition="'$(Configuration)' == 'Debug'">False</PublishTrimmed>
17+
<PublishTrimmed Condition="'$(Configuration)' != 'Debug'">True</PublishTrimmed>
18+
</PropertyGroup>
19+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
https://go.microsoft.com/fwlink/?LinkID=208121.
4+
-->
5+
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
6+
<PropertyGroup>
7+
<PublishProtocol>FileSystem</PublishProtocol>
8+
<Platform>x64</Platform>
9+
<RuntimeIdentifier Condition="$([MSBuild]::GetTargetFrameworkVersion('$(TargetFramework)')) >= 8">win-x64</RuntimeIdentifier>
10+
<RuntimeIdentifier Condition="$([MSBuild]::GetTargetFrameworkVersion('$(TargetFramework)')) &lt; 8">win10-x64</RuntimeIdentifier>
11+
<PublishDir>bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\</PublishDir>
12+
<SelfContained>true</SelfContained>
13+
<PublishSingleFile>False</PublishSingleFile>
14+
<PublishReadyToRun Condition="'$(Configuration)' == 'Debug'">False</PublishReadyToRun>
15+
<PublishReadyToRun Condition="'$(Configuration)' != 'Debug'">True</PublishReadyToRun>
16+
<PublishTrimmed Condition="'$(Configuration)' == 'Debug'">False</PublishTrimmed>
17+
<PublishTrimmed Condition="'$(Configuration)' != 'Debug'">True</PublishTrimmed>
18+
</PropertyGroup>
19+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
https://go.microsoft.com/fwlink/?LinkID=208121.
4+
-->
5+
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
6+
<PropertyGroup>
7+
<PublishProtocol>FileSystem</PublishProtocol>
8+
<Platform>x86</Platform>
9+
<RuntimeIdentifier Condition="$([MSBuild]::GetTargetFrameworkVersion('$(TargetFramework)')) >= 8">win-x86</RuntimeIdentifier>
10+
<RuntimeIdentifier Condition="$([MSBuild]::GetTargetFrameworkVersion('$(TargetFramework)')) &lt; 8">win10-x86</RuntimeIdentifier>
11+
<PublishDir>bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\</PublishDir>
12+
<SelfContained>true</SelfContained>
13+
<PublishSingleFile>False</PublishSingleFile>
14+
<PublishReadyToRun Condition="'$(Configuration)' == 'Debug'">False</PublishReadyToRun>
15+
<PublishReadyToRun Condition="'$(Configuration)' != 'Debug'">True</PublishReadyToRun>
16+
<PublishTrimmed Condition="'$(Configuration)' == 'Debug'">False</PublishTrimmed>
17+
<PublishTrimmed Condition="'$(Configuration)' != 'Debug'">True</PublishTrimmed>
18+
</PropertyGroup>
19+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"profiles": {
3+
"WinUI3GetStarted (Package)": {
4+
"commandName": "MsixPackage"
5+
},
6+
"WinUI3GetStarted (Unpackaged)": {
7+
"commandName": "Project"
8+
}
9+
}
10+
}

0 commit comments

Comments
 (0)