Skip to content

Commit 5ec8418

Browse files
authored
Trim down framework references for Blazor dev server (#31420)
* Only include Microsoft.AspNetCore.App framework reference for Blazor dev server * Address feedback from peer review * Use SharedFxVersion property
1 parent fb0b099 commit 5ec8418

5 files changed

+31
-7
lines changed

eng/Versions.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@
261261
<XunitExtensibilityExecutionVersion>$(XunitVersion)</XunitExtensibilityExecutionVersion>
262262
<XUnitRunnerVisualStudioVersion>2.4.3</XUnitRunnerVisualStudioVersion>
263263
<MicrosoftDataSqlClientVersion>1.0.19249.1</MicrosoftDataSqlClientVersion>
264+
<MicrosoftAspNetCoreAppVersion>6.0.0-preview.3.21167.1</MicrosoftAspNetCoreAppVersion>
264265
</PropertyGroup>
265266
<!-- Restore feeds -->
266267
<PropertyGroup Label="Restore feeds">

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

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
<GenerateDocumentationFile>true</GenerateDocumentationFile>
1212
<!-- Set this to false because assemblies should not reference this assembly directly, (except for tests, of course). -->
1313
<IsProjectReferenceProvider>false</IsProjectReferenceProvider>
14+
<!-- Disable the default runtimeconfig.json in favor of the one that we create which contains the correct
15+
framework references. Workaround for issues launching Blazor WASM apps with IIS Express. -->
16+
<GenerateRuntimeConfigurationFiles>false</GenerateRuntimeConfigurationFiles>
1417
</PropertyGroup>
1518

1619
<ItemGroup>
@@ -19,6 +22,21 @@
1922
<Compile Include="$(SharedSourceRoot)CommandLineUtils\**\*.cs" />
2023
</ItemGroup>
2124

25+
<Target Name="_CreateRuntimeConfig" BeforeTargets="CoreBuild">
26+
<PropertyGroup>
27+
<_RuntimeConfigProperties>
28+
SharedFxVersion=$(SharedFxVersion);
29+
</_RuntimeConfigProperties>
30+
31+
<_RuntimeConfigPath>$(IntermediateOutputPath)blazor-devserver.runtimeconfig.json</_RuntimeConfigPath>
32+
</PropertyGroup>
33+
34+
<GenerateFileFromTemplate
35+
TemplateFile="blazor-devserver.runtimeconfig.json.in"
36+
Properties="$(_RuntimeConfigProperties)"
37+
OutputPath="$(_RuntimeConfigPath)" />
38+
</Target>
39+
2240
<!-- Pack settings -->
2341
<PropertyGroup>
2442
<GenerateNuspecDependsOn>$(GenerateNuspecDependsOn);publish</GenerateNuspecDependsOn>
@@ -28,6 +46,7 @@
2846

2947
<ItemGroup>
3048
<NuspecProperty Include="publishDir=$(PublishDir)" />
49+
<NuspecProperty Include="objDir=$(IntermediateOutputPath)" />
3150
<NuspecProperty Include="PackageThirdPartyNoticesFile=$(PackageThirdPartyNoticesFile)" />
3251
</ItemGroup>
3352

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@
88
<file src="build\**" target="build" />
99
<file src="$publishDir$**\*" target="tools" />
1010
<file src="$PackageThirdPartyNoticesFile$" target=".\THIRD-PARTY-NOTICES.txt" />
11+
<file src="$objDir$blazor-devserver.runtimeconfig.json" target="tools\blazor-devserver.runtimeconfig.json" />
1112
</files>
1213
</package>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"runtimeOptions": {
3+
"tfm": "net6.0",
4+
"framework": {
5+
"name": "Microsoft.AspNetCore.App",
6+
"version": "${SharedFxVersion}"
7+
},
8+
"rollForwardOnNoCandidateFx": 2
9+
}
10+
}

src/Components/WebAssembly/DevServer/src/runtimeconfig.template.json

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

0 commit comments

Comments
 (0)