Skip to content

Commit 785aeb3

Browse files
authored
Cleanup the dev server (#32743)
1 parent 50b2470 commit 785aeb3

File tree

9 files changed

+16
-73
lines changed

9 files changed

+16
-73
lines changed

eng/scripts/CodeCheck.ps1

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,9 @@ try {
208208
foreach ($file in $changedFilesFromTarget) {
209209
# Check for changes in Shipped in all branches
210210
if ($file -like '*PublicAPI.Shipped.txt') {
211-
$changedAPIBaselines.Add($file)
211+
if (!$file.Contains('DevServer/src/PublicAPI.Shipped.txt')) {
212+
$changedAPIBaselines.Add($file)
213+
}
212214
}
213215
# Check for changes in Unshipped in servicing branches
214216
if ($targetBranch -like 'release*' -and $targetBranch -notlike '*preview*' -and $file -like '*PublicAPI.Unshipped.txt') {

src/Components/Directory.Build.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
<_BlazorDevServerPath>$(ArtifactsDir)bin/Microsoft.AspNetCore.Components.WebAssembly.DevServer/$(Configuration)/$(DefaultNetCoreTargetFramework)/blazor-devserver.dll</_BlazorDevServerPath>
1111
<RunCommand>dotnet</RunCommand>
12-
<RunArguments>exec &quot;$(_BlazorDevServerPath)&quot; serve --applicationpath &quot;$(TargetPath)&quot; $(AdditionalRunArguments)</RunArguments>
12+
<RunArguments>exec &quot;$(_BlazorDevServerPath)&quot; --applicationpath &quot;$(TargetPath)&quot; $(AdditionalRunArguments)</RunArguments>
1313
</PropertyGroup>
1414

1515
<ItemGroup>

src/Components/WebAssembly/DevServer/src/Commands/ServeCommand.cs

Lines changed: 0 additions & 34 deletions
This file was deleted.

src/Components/WebAssembly/DevServer/src/Microsoft.AspNetCore.Components.WebAssembly.DevServer.csproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,15 @@
1414
<!-- Disable the default runtimeconfig.json in favor of the one that we create which contains the correct
1515
framework references. Workaround for issues launching Blazor WASM apps with IIS Express. -->
1616
<GenerateRuntimeConfigurationFiles>false</GenerateRuntimeConfigurationFiles>
17+
<AddPublicApiAnalyzers>false</AddPublicApiAnalyzers>
18+
<Nullable>enable</Nullable>
1719
</PropertyGroup>
1820

1921
<ItemGroup>
2022
<Reference Include="Microsoft.AspNetCore" />
2123
<Reference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" />
22-
<Compile Include="$(SharedSourceRoot)CommandLineUtils\**\*.cs" />
2324
</ItemGroup>
24-
25+
2526
<!-- We include this here to ensure that the shared framework is built before we leverage it when running
2627
the dev server. -->
2728
<ItemGroup>
Lines changed: 6 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,19 @@
11
// Copyright (c) .NET Foundation. All rights reserved.
22
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
33

4-
using Microsoft.AspNetCore.Components.Web.DevServer.Commands;
5-
using Microsoft.Extensions.CommandLineUtils;
4+
using Microsoft.AspNetCore.Hosting;
5+
using Microsoft.Extensions.Hosting;
6+
using DevServerProgram = Microsoft.AspNetCore.Components.WebAssembly.DevServer.Server.Program;
7+
68

79
namespace Microsoft.AspNetCore.Components.WebAssembly.DevServer
810
{
911
internal class Program
1012
{
1113
static int Main(string[] args)
1214
{
13-
var app = new CommandLineApplication(throwOnUnexpectedArg: false)
14-
{
15-
Name = "blazor-devserver"
16-
};
17-
app.HelpOption("-?|-h|--help");
18-
19-
app.Commands.Add(new ServeCommand(app));
20-
21-
// A command is always required
22-
app.OnExecute(() =>
23-
{
24-
app.ShowHelp();
25-
return 0;
26-
});
27-
28-
try
29-
{
30-
return app.Execute(args);
31-
}
32-
catch (CommandParsingException cex)
33-
{
34-
app.Error.WriteLine(cex.Message);
35-
app.ShowHelp();
36-
return 1;
37-
}
15+
DevServerProgram.BuildWebHost(args).Run();
16+
return 0;
3817
}
3918
}
4019
}

src/Components/WebAssembly/DevServer/src/PublicAPI.Shipped.txt

Lines changed: 0 additions & 4 deletions
This file was deleted.

src/Components/WebAssembly/DevServer/src/PublicAPI.Unshipped.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/Components/WebAssembly/DevServer/src/Server/Program.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ public static IHost BuildWebHost(string[] args) =>
2626
Host.CreateDefaultBuilder(args)
2727
.ConfigureHostConfiguration(config =>
2828
{
29-
var applicationPath = args.SkipWhile(a => a != "--applicationpath").Skip(1).FirstOrDefault();
30-
var applicationDirectory = Path.GetDirectoryName(applicationPath);
29+
var applicationPath = args.SkipWhile(a => a != "--applicationpath").Skip(1).First();
30+
var applicationDirectory = Path.GetDirectoryName(applicationPath)!;
3131
var name = Path.ChangeExtension(applicationPath, ".StaticWebAssets.xml");
3232

3333
var inMemoryConfiguration = new Dictionary<string, string>

src/Components/WebAssembly/DevServer/src/build/Microsoft.AspNetCore.Components.WebAssembly.DevServer.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
<PropertyGroup>
33
<_BlazorDevServerDll>$(MSBuildThisFileDirectory)../tools/blazor-devserver.dll</_BlazorDevServerDll>
44
<RunCommand>dotnet</RunCommand>
5-
<RunArguments>&quot;$(_BlazorDevServerDll)&quot; serve --applicationpath &quot;$(TargetPath)&quot;</RunArguments>
5+
<RunArguments>&quot;$(_BlazorDevServerDll)&quot; --applicationpath &quot;$(TargetPath)&quot;</RunArguments>
66
</PropertyGroup>
77
</Project>

0 commit comments

Comments
 (0)