Skip to content

Commit 3fe6b07

Browse files
authored
Ensure BlazorWebAssembly.js is present (#23518)
1 parent eb76931 commit 3fe6b07

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<Project>
2+
<PropertyGroup>
3+
<BlazorWebAssemblyJSPath>$(MSBuildThisFileDirectory)blazor.webassembly.js</BlazorWebAssemblyJSPath>
4+
</PropertyGroup>
5+
</Project>

src/Razor/Microsoft.NET.Sdk.Razor/src/build/netstandard2.0/Microsoft.NET.Sdk.Razor.Components.Wasm.targets

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ Copyright (c) .NET Foundation. All rights reserved.
9292
<!--
9393
Calculates the outputs and the paths for Blazor WASM. This target is invoked frequently and should perform minimal work.
9494
-->
95+
9596
<ItemGroup>
9697
<_BlazorJSFile Include="$(BlazorWebAssemblyJSPath)" />
9798
<_BlazorJSFile Include="$(BlazorWebAssemblyJSMapPath)" Condition="Exists('$(BlazorWebAssemblyJSMapPath)')" />
@@ -140,7 +141,7 @@ Copyright (c) .NET Foundation. All rights reserved.
140141
<Output TaskParameter="SatelliteAssembly" ItemName="_BlazorReadSatelliteAssembly" />
141142
</BlazorReadSatelliteAssemblyFile>
142143

143-
<ItemGroup >
144+
<ItemGroup>
144145
<!-- We've imported a previously Cacheed file. Let's turn in to a _BlazorOutputWithTargetPath -->
145146
<_BlazorOutputWithTargetPath
146147
Include="@(_BlazorReadSatelliteAssembly)"
@@ -162,6 +163,12 @@ Copyright (c) .NET Foundation. All rights reserved.
162163
<ReferenceCopyLocalPaths DestinationSubDirectory="$(_BlazorOutputPath)%(ReferenceCopyLocalPaths.DestinationSubDirectory)" />
163164
</ItemGroup>
164165

166+
<!-- A missing blazor.webassembly.js is our packaging error. Produce an error so it's discovered early. -->
167+
<Error
168+
Text="Unable to find BlazorWebAssembly JS files. This usually indicates a packaging error."
169+
Code="RAZORSDK1007"
170+
Condition="'@(_BlazorJSFile->Count())' == '0'" />
171+
165172
<!--
166173
When building with BuildingProject=false, satellite assemblies do not get resolved (the ones for the current project and the one for
167174
referenced project). BuildingProject=false is typically set for referenced projects when building inside VisualStudio.

0 commit comments

Comments
 (0)