Skip to content

Commit ea34936

Browse files
committed
[Blazor] Avoid defining webassembly.js as a framework asset
1 parent e983910 commit ea34936

File tree

4 files changed

+19
-37
lines changed

4 files changed

+19
-37
lines changed

src/Assets/build/Microsoft.AspNetCore.App.Internal.Assets.targets

Lines changed: 4 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,6 @@
2121
<_FrameworkStaticWebAssetCandidate Include="$(BlazorFrameworkStaticWebAssetRoot)\blazor.server.js.map" />
2222
</ItemGroup>
2323

24-
<PropertyGroup>
25-
<_IncludeAssetsInBlazorWebAssemblyProject Condition="'$(UsingMicrosoftNETSdkBlazorWebAssembly)' == 'true' AND '$(StaticWebAssetProjectMode)' != 'Default'">true</_IncludeAssetsInBlazorWebAssemblyProject>
26-
</PropertyGroup>
27-
28-
<ItemGroup Condition="'$(_IncludeAssetsInBlazorWebAssemblyProject)' == 'true'">
29-
<_FrameworkStaticWebAssetCandidate Include="$(BlazorFrameworkStaticWebAssetRoot)\blazor.webassembly.js" />
30-
</ItemGroup>
31-
32-
<ItemGroup Condition="'$(_IncludeAssetsInBlazorWebAssemblyProject)' == 'true' AND '$(UseBlazorFrameworkDebugAssets)' == 'true'">
33-
<_FrameworkStaticWebAssetCandidate Include="$(BlazorFrameworkStaticWebAssetRoot)\blazor.webassembly.js.map" />
34-
</ItemGroup>
35-
3624
<ItemGroup>
3725
<_MissingFrameworkStaticWebAssetCandidate
3826
Include="@(_FrameworkStaticWebAssetCandidate)"
@@ -45,35 +33,14 @@
4533
Condition="'@(_MissingFrameworkStaticWebAssetCandidate->Count())' != '0'"
4634
Text="Framework asset '%(_MissingFrameworkStaticWebAssetCandidate.Identity)' could not be found and won't be included in the project." />
4735

48-
<PropertyGroup>
49-
<_FrameworkAssetsPath>$(IntermediateOutputPath)frameworkassets</_FrameworkAssetsPath>
50-
</PropertyGroup>
51-
52-
<MakeDir
53-
Directories="$(_FrameworkAssetsPath)"
54-
Condition="!EXISTS('$(_FrameworkAssetsPath)')" />
55-
56-
<Copy
57-
SourceFiles="@(_FrameworkStaticWebAssetCandidate)"
58-
DestinationFolder="$(_FrameworkAssetsPath)"
59-
SkipUnchangedFiles="true">
60-
<Output TaskParameter="CopiedFiles" ItemName="_CopiedFrameworkStaticWebAssetCandidate" />
61-
</Copy>
62-
63-
<ItemGroup>
64-
<_CopiedFrameworkStaticWebAssetCandidate>
65-
<RelativePath>_framework\%(FileName)%(Extension)</RelativePath>
66-
<ContentRoot>$(_FrameworkAssetsPath)</ContentRoot>
67-
</_CopiedFrameworkStaticWebAssetCandidate>
68-
</ItemGroup>
69-
7036
<DefineStaticWebAssets
71-
Condition="'@(_CopiedFrameworkStaticWebAssetCandidate->Count())' != '0'"
72-
CandidateAssets="@(_CopiedFrameworkStaticWebAssetCandidate)"
37+
Condition="'@(_FrameworkStaticWebAssetCandidate->Count())' != '0'"
38+
CandidateAssets="@(_FrameworkStaticWebAssetCandidate)"
39+
ContentRoot="$(BlazorFrameworkStaticWebAssetRoot)"
7340
SourceId="$(PackageId)"
7441
SourceType="Discovered"
7542
AssetKind="All"
76-
AssetMode="All"
43+
AssetMode="CurrentProject"
7744
AssetRole="Primary"
7845
FingerprintCandidates="true"
7946
BasePath="$(StaticWebAssetBasePath)">
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
11
<Project>
2+
<PropertyGroup Condition="'$(UsingMicrosoftNETSdkBlazorWebAssembly)' == 'true'">
3+
<BlazorWebAssemblyJSPath
4+
Condition=" '$(Configuration)' == 'Debug' ">$(RepoRoot)src\Components\Web.JS\dist\Debug\blazor.webassembly.js</BlazorWebAssemblyJSPath>
5+
<BlazorWebAssemblyJSPath
6+
Condition=" '$(Configuration)' != 'Debug' ">$(RepoRoot)src\Components\Web.JS\dist\Release\blazor.webassembly.js</BlazorWebAssemblyJSPath>
7+
<BlazorWebAssemblyJSMapPath>$(BlazorWebAssemblyJSPath).map</BlazorWebAssemblyJSMapPath>
8+
</PropertyGroup>
9+
210
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory)..\, Directory.Build.targets))\Directory.Build.targets" />
311
</Project>

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,13 @@
5252
<InternalsVisibleTo Include="BasicTestApp" />
5353
</ItemGroup>
5454

55+
<PropertyGroup>
56+
<BlazorWebAssemblyJSFile Condition=" '$(Configuration)' == 'Debug' ">..\..\..\Web.JS\dist\Debug\blazor.webassembly.js</BlazorWebAssemblyJSFile>
57+
<BlazorWebAssemblyJSFile Condition=" '$(Configuration)' != 'Debug' ">..\..\..\Web.JS\dist\Release\blazor.webassembly.js</BlazorWebAssemblyJSFile>
58+
</PropertyGroup>
59+
5560
<ItemGroup>
61+
<Content Include="$(BlazorWebAssemblyJSFile)" Pack="true" PackagePath="build\$(DefaultNetCoreTargetFramework)\" LinkBase="build\$(DefaultNetCoreTargetFramework)\" />
5662
<Content Include="targets\*.props" Pack="true" PackagePath="build\$(DefaultNetCoreTargetFramework)\" />
5763
</ItemGroup>
5864

src/Components/WebAssembly/WebAssembly/src/targets/Microsoft.AspNetCore.Components.WebAssembly.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<Project>
22
<PropertyGroup>
3+
<BlazorWebAssemblyJSPath>$(MSBuildThisFileDirectory)blazor.webassembly.js</BlazorWebAssemblyJSPath>
34
<BlazorRoutingEnableRegexConstraint Condition="'$(BlazorRoutingEnableRegexConstraint)' == ''">false</BlazorRoutingEnableRegexConstraint>
45
</PropertyGroup>
56

0 commit comments

Comments
 (0)