Skip to content

Commit 65f441a

Browse files
feat: dev tools (#10)
1 parent 03c0e06 commit 65f441a

9 files changed

Lines changed: 52 additions & 36 deletions

File tree

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Blazor Desktop allows you to create desktop apps using Blazor. Apps run inside o
1010
The easiest way to get started with Blazor Desktop is to install the templates, you can do so using the dotnet cli as follows:
1111

1212
```powershell
13-
dotnet new --install BlazorDesktop.Templates::1.0.5
13+
dotnet new --install BlazorDesktop.Templates::1.1.0
1414
```
1515

1616
Once you have the templates installed, you can either create a new project from the template either in Visual Studio in the template picker:
@@ -36,6 +36,11 @@ builder.RootComponents.Add<HeadOutlet>("head::after");
3636

3737
builder.Services.AddSingleton<WeatherForecastService>();
3838

39+
if (builder.HostEnvironment.IsDevelopment())
40+
{
41+
builder.UseDeveloperTools();
42+
}
43+
3944
await builder.Build().RunAsync();
4045
```
4146

src/BlazorDesktop.Sample/Program.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,9 @@
1313

1414
builder.Services.AddSingleton<WeatherForecastService>();
1515

16+
if (builder.HostEnvironment.IsDevelopment())
17+
{
18+
builder.UseDeveloperTools();
19+
}
20+
1621
await builder.Build().RunAsync();

src/BlazorDesktop.Templates/BlazorDesktop.Templates.csproj

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,14 @@
22

33
<PropertyGroup>
44
<PackageType>Template</PackageType>
5-
<PackageVersion>1.0.5</PackageVersion>
65
<PackageId>BlazorDesktop.Templates</PackageId>
76
<Title>Blazor Desktop Templates</Title>
8-
<Authors>Andrew Babbitt</Authors>
9-
<Company>Andrew Babbitt</Company>
10-
<Product>Blazor Desktop</Product>
117
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
12-
<RepositoryUrl>https://github.com/AndrewBabbitt97/BlazorDesktop</RepositoryUrl>
13-
<PackageReleaseNotes>https://github.com/AndrewBabbitt97/BlazorDesktop/releases</PackageReleaseNotes>
14-
<Description>A framework for building desktop applications using Blazor.</Description>
15-
<Copyright>© Andrew Babbitt. All rights reserved.</Copyright>
16-
<PackageProjectUrl>https://github.com/AndrewBabbitt97/BlazorDesktop</PackageProjectUrl>
17-
<PackageTags>Blazor;Desktop;BlazorDesktop;WebView2;WebView</PackageTags>
18-
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
198
<TargetFramework>netstandard2.0</TargetFramework>
209
<IncludeContentInPack>true</IncludeContentInPack>
2110
<IncludeBuildOutput>false</IncludeBuildOutput>
2211
<ContentTargetDirectory>content</ContentTargetDirectory>
2312
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
24-
<RepositoryType>git</RepositoryType>
2513
<NoWarn>$(NoWarn);NU5128</NoWarn>
2614
<PackageIcon>nuget.png</PackageIcon>
2715
<LangVersion>10.0</LangVersion>

src/BlazorDesktop.Templates/templates/BlazorDesktop-CSharp/BlazorDesktop-CSharp.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
</PropertyGroup>
1010

1111
<ItemGroup>
12-
<PackageReference Include="BlazorDesktop" Version="1.0.5" />
12+
<PackageReference Include="BlazorDesktop" Version="1.1.0" />
1313
</ItemGroup>
1414

1515
</Project>

src/BlazorDesktop.Templates/templates/BlazorDesktop-CSharp/Program.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,9 @@
99

1010
builder.Services.AddSingleton<WeatherForecastService>();
1111

12+
if (builder.HostEnvironment.IsDevelopment())
13+
{
14+
builder.UseDeveloperTools();
15+
}
16+
1217
await builder.Build().RunAsync();

src/BlazorDesktop/BlazorDesktop.csproj

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,36 +3,17 @@
33
<PropertyGroup>
44
<OutputType>Library</OutputType>
55
<TargetFramework>net6.0-windows</TargetFramework>
6-
<Nullable>enable</Nullable>
7-
<ImplicitUsings>enable</ImplicitUsings>
86
<UseWPF>true</UseWPF>
97
<NoDefaultLaunchSettingsFile>true</NoDefaultLaunchSettingsFile>
10-
<GenerateDocumentationFile>true</GenerateDocumentationFile>
118
</PropertyGroup>
129

1310
<PropertyGroup>
1411
<IsPackable>true</IsPackable>
1512
<PackageId>BlazorDesktop</PackageId>
1613
<Platforms>AnyCPU;x86;x64</Platforms>
17-
<Authors>Andrew Babbitt</Authors>
18-
<Company>Andrew Babbitt</Company>
19-
<Product>Blazor Desktop</Product>
2014
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
21-
<RepositoryUrl>https://github.com/AndrewBabbitt97/BlazorDesktop</RepositoryUrl>
22-
<PackageReleaseNotes>https://github.com/AndrewBabbitt97/BlazorDesktop/releases</PackageReleaseNotes>
23-
<Description>A framework for building desktop applications using Blazor.</Description>
24-
<Copyright>© Andrew Babbitt. All rights reserved.</Copyright>
25-
<PackageProjectUrl>https://github.com/AndrewBabbitt97/BlazorDesktop</PackageProjectUrl>
26-
<PackageTags>Blazor;Desktop;BlazorDesktop;WebView2;WebView</PackageTags>
27-
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
2815
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
2916
<PackageIcon>nuget.png</PackageIcon>
30-
<RepositoryType>git</RepositoryType>
31-
<AssemblyVersion>1.0.5.0</AssemblyVersion>
32-
<FileVersion>1.0.5.0</FileVersion>
33-
<Version>1.0.5</Version>
34-
<IncludeSymbols>true</IncludeSymbols>
35-
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
3617
</PropertyGroup>
3718

3819
<ItemGroup>
@@ -47,7 +28,7 @@
4728
</ItemGroup>
4829

4930
<ItemGroup>
50-
<PackageReference Include="Microsoft.AspNetCore.Components.WebView.Wpf" Version="6.0.200-preview.14.5099+sha.03a0eb8e6-azdo.5845410" />
31+
<PackageReference Include="Microsoft.AspNetCore.Components.WebView.Wpf" Version="6.0.300-rc.2.5513" />
5132
<PackageReference Include="WebView2.Runtime.AutoInstaller" Version="1.0.0" />
5233
</ItemGroup>
5334

src/BlazorDesktop/Hosting/BlazorDesktopHostBuilder.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public BlazorDesktopHost Build()
9090
})
9191
.ConfigureServices(services =>
9292
{
93-
services.AddBlazorWebView();
93+
services.AddWpfBlazorWebView();
9494

9595
services.AddSingleton(HostEnvironment);
9696
services.AddSingleton(RootComponents);
@@ -108,6 +108,16 @@ public BlazorDesktopHost Build()
108108
return new(builder.Build());
109109
}
110110

111+
/// <summary>
112+
/// Adds Chromium dev tools to the Blazor Desktop application.
113+
/// </summary>
114+
/// <returns>The <see cref="BlazorDesktopHostBuilder"/>.</returns>
115+
public BlazorDesktopHostBuilder UseDeveloperTools()
116+
{
117+
Services.AddBlazorWebViewDeveloperTools();
118+
return this;
119+
}
120+
111121
/// <summary>
112122
/// Initializes the environment.
113123
/// </summary>

src/BlazorDesktop/Wpf/BlazorDesktopWindow.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public BlazorDesktopWindow(IServiceProvider services, RootComponentMappingCollec
8080
{
8181
Selector = c.Selector,
8282
ComponentType = c.ComponentType,
83-
Parameters = (IDictionary<string, object>)c.Parameters.ToDictionary()
83+
Parameters = (IDictionary<string, object?>)c.Parameters.ToDictionary()
8484
});
8585
_config = config;
8686
_environment = environment;

src/Directory.Build.props

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,30 @@
11
<Project>
2+
23
<PropertyGroup>
34
<Nullable>enable</Nullable>
45
<ImplicitUsings>enable</ImplicitUsings>
56
<WarningsAsErrors>Nullable</WarningsAsErrors>
67
<GenerateDocumentationFile>true</GenerateDocumentationFile>
78
</PropertyGroup>
9+
10+
<PropertyGroup>
11+
<Version>1.1.0</Version>
12+
<PackageVersion>1.1.0</PackageVersion>
13+
<FileVersion>1.1.0.0</FileVersion>
14+
<AssemblyVersion>1.1.0.0</AssemblyVersion>
15+
<Authors>Andrew Babbitt</Authors>
16+
<Company>Andrew Babbitt</Company>
17+
<Product>Blazor Desktop</Product>
18+
<RepositoryUrl>https://github.com/AndrewBabbitt97/BlazorDesktop</RepositoryUrl>
19+
<PackageReleaseNotes>https://github.com/AndrewBabbitt97/BlazorDesktop/releases</PackageReleaseNotes>
20+
<Description>A framework for building desktop applications using Blazor.</Description>
21+
<Copyright>© Andrew Babbitt. All rights reserved.</Copyright>
22+
<PackageProjectUrl>https://github.com/AndrewBabbitt97/BlazorDesktop</PackageProjectUrl>
23+
<PackageTags>Blazor;Desktop;BlazorDesktop;WebView2;WebView</PackageTags>
24+
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
25+
<RepositoryType>git</RepositoryType>
26+
<IncludeSymbols>true</IncludeSymbols>
27+
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
28+
</PropertyGroup>
29+
830
</Project>

0 commit comments

Comments
 (0)