Skip to content

Commit 94eedae

Browse files
committed
Include .map files
1 parent b3755e5 commit 94eedae

File tree

2 files changed

+74
-9
lines changed

2 files changed

+74
-9
lines changed

src/Assets/Pack/Microsoft.AspNetCore.Assets.Pack.csproj

Lines changed: 67 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,21 +40,29 @@
4040
<_BlazorJSFilename Include="blazor.webassembly.js" />
4141

4242
<_BlazorJSFile Include="@(_BlazorJSFilename->'$(_BlazorJSContentRoot)\%(Identity)')" />
43+
<_BlazorJSMapFile Include="@(_BlazorJSFilename->'$(_BlazorJSContentRoot)\%(Identity).map')" />
4344
</ItemGroup>
4445

4546
<Target Name="_CheckBlazorJSPath" AfterTargets="ResolveProjectReferences">
4647

4748
<ItemGroup>
4849
<_MissingBlazorJSFile Include="@(_BlazorJSFile)" Condition="!EXISTS('%(_BlazorJSFile.FullPath)')" />
50+
<_MissingBlazorJSMapFile Include="@(_BlazorJSMapFile)" Condition="!EXISTS('%(_BlazorJSMapFile.FullPath)')" />
51+
52+
<_AllMissingBlazorJSFiles Include="@(_MissingBlazorJSFile)" />
53+
<_AllMissingBlazorJSFiles Include="@(_MissingBlazorJSMapFile)" />
4954
</ItemGroup>
5055

5156
<Warning
52-
Condition="'@(_MissingBlazorJSFile)' != ''"
53-
Text="'%(_MissingBlazorJSFile.Identity)' does not exist. Falling back to checked-in copy." />
57+
Condition="'@(_AllMissingBlazorJSFiles)' != ''"
58+
Text="'%(_AllMissingBlazorJSFiles.Identity)' does not exist. Falling back to checked-in copy." />
5459

5560
<ItemGroup>
5661
<_BlazorJSFile Remove="@(_MissingBlazorJSFile)" />
5762
<_BlazorJSFile Include="@(_MissingBlazorJSFile->'..\..\Components\Web.JS\dist\Release\%(Filename)%(Extension)')" />
63+
64+
<_BlazorJSMapFile Remove="@(_MissingBlazorJSMapFile)" />
65+
<_BlazorJSMapFile Include="@(_MissingBlazorJSMapFile->'..\..\Components\Web.JS\dist\Release\%(Filename)%(Extension)')" />
5866
</ItemGroup>
5967

6068
</Target>
@@ -63,6 +71,7 @@
6371

6472
<ItemGroup>
6573
<_ReferenceAssetCandidates Include="@(_BlazorJSFile)" />
74+
<_ReferenceAssetCandidates Include="@(_BlazorJSMapFile)" />
6675
<_ReferenceAssetCandidates>
6776
<RelativePath>$(StaticWebAssetBasePath)/%(FileName)%(Extension)</RelativePath>
6877
<ContentRoot>$([System.IO.Path]::GetFullPath($([System.IO.Path]::GetDirectoryName('%(Identity)'))))</ContentRoot>
@@ -94,13 +103,19 @@
94103
<_AssetCandidates Include="@(_BlazorJSFile)" />
95104
<_AssetCandidates>
96105
<RelativePath>%(RecursiveDir)%(FileName)%(Extension)</RelativePath>
106+
<ContentRoot>$([System.IO.Path]::GetFullPath($([System.IO.Path]::GetDirectoryName('%(Identity)'))))</ContentRoot>
97107
</_AssetCandidates>
108+
109+
<_DebugAssetCandidates Include="@(_BlazorJSMapFile)" />
110+
<_DebugAssetCandidates>
111+
<RelativePath>%(RecursiveDir)%(FileName)%(Extension)</RelativePath>
112+
<ContentRoot>$([System.IO.Path]::GetFullPath($([System.IO.Path]::GetDirectoryName('%(Identity)'))))</ContentRoot>
113+
</_DebugAssetCandidates>
98114
</ItemGroup>
99115

100116
<DefineStaticWebAssets
101117
Condition="'@(_AssetCandidates->Count())' != '0'"
102118
CandidateAssets="@(_AssetCandidates)"
103-
ContentRoot="_framework"
104119
AssetKind="All"
105120
SourceId="$(PackageId)"
106121
SourceType="Discovered"
@@ -110,6 +125,18 @@
110125
<Output TaskParameter="Assets" ItemName="_FrameworkAssets" />
111126
</DefineStaticWebAssets>
112127

128+
<DefineStaticWebAssets
129+
Condition="'@(_DebugAssetCandidates->Count())' != '0'"
130+
CandidateAssets="@(_DebugAssetCandidates)"
131+
AssetKind="All"
132+
SourceId="$(PackageId)"
133+
SourceType="Discovered"
134+
FingerprintCandidates="true"
135+
BasePath="$(StaticWebAssetBasePath)"
136+
>
137+
<Output TaskParameter="Assets" ItemName="_DebugFrameworkAssets" />
138+
</DefineStaticWebAssets>
139+
113140
<DefineStaticWebAssetEndpoints
114141
Condition="'@(_FrameworkAssets)' != ''"
115142
CandidateAssets="@(_FrameworkAssets)"
@@ -118,33 +145,66 @@
118145
<Output TaskParameter="Endpoints" ItemName="_FrameworkAssetEndpoints" />
119146
</DefineStaticWebAssetEndpoints>
120147

148+
<DefineStaticWebAssetEndpoints
149+
Condition="'@(_DebugFrameworkAssets)' != ''"
150+
CandidateAssets="@(_DebugFrameworkAssets)"
151+
ExistingEndpoints="@()"
152+
ContentTypeMappings="@(StaticWebAssetContentTypeMapping)">
153+
<Output TaskParameter="Endpoints" ItemName="_DebugFrameworkAssetEndpoints" />
154+
</DefineStaticWebAssetEndpoints>
155+
121156
<ComputeEndpointsForReferenceStaticWebAssets
122157
Assets="@(_FrameworkAssets)"
123158
CandidateEndpoints="@(_FrameworkAssetEndpoints)">
124159
<Output TaskParameter="Endpoints" ItemName="_PackFrameworkAssetEndpoints" />
125160
</ComputeEndpointsForReferenceStaticWebAssets>
126161

162+
<ComputeEndpointsForReferenceStaticWebAssets
163+
Assets="@(_DebugFrameworkAssets)"
164+
CandidateEndpoints="@(_DebugFrameworkAssetEndpoints)">
165+
<Output TaskParameter="Endpoints" ItemName="_PackDebugFrameworkAssetEndpoints" />
166+
</ComputeEndpointsForReferenceStaticWebAssets>
167+
127168
<GenerateStaticWebAssetsPropsFile
128169
StaticWebAssets="@(_FrameworkAssets)"
129170
PackagePathPrefix="staticwebassets"
130-
TargetPropsFilePath="$(IntermediateOutputPath)StaticWebAssets.targets" />
171+
TargetPropsFilePath="$(IntermediateOutputPath)Assets.Pack.targets" />
172+
173+
<GenerateStaticWebAssetsPropsFile
174+
StaticWebAssets="@(_DebugFrameworkAssets)"
175+
PackagePathPrefix="staticwebassets"
176+
TargetPropsFilePath="$(IntermediateOutputPath)Assets.Pack.debug.targets" />
131177

132178
<GenerateStaticWebAssetEndpointsPropsFile
133179
StaticWebAssets="@(_FrameworkAssets)"
134180
StaticWebAssetEndpoints="@(_PackFrameworkAssetEndpoints)"
135-
TargetPropsFilePath="$(IntermediateOutputPath)StaticWebAssets.endpoints.targets" />
181+
TargetPropsFilePath="$(IntermediateOutputPath)Assets.Pack.endpoints.targets" />
182+
183+
<GenerateStaticWebAssetEndpointsPropsFile
184+
StaticWebAssets="@(_DebugFrameworkAssets)"
185+
StaticWebAssetEndpoints="@(_PackDebugFrameworkAssetEndpoints)"
186+
TargetPropsFilePath="$(IntermediateOutputPath)Assets.Pack.debug.endpoints.targets" />
136187

137188
<ComputeStaticWebAssetsTargetPaths Assets="@(_FrameworkAssets)" PathPrefix="staticwebassets" AdjustPathsForPack="true">
138189
<Output TaskParameter="AssetsWithTargetPath" ItemName="_PackStaticWebAssetWithTargetPath" />
139190
</ComputeStaticWebAssetsTargetPaths>
191+
<ComputeStaticWebAssetsTargetPaths Assets="@(_DebugFrameworkAssets)" PathPrefix="staticwebassets" AdjustPathsForPack="true">
192+
<Output TaskParameter="AssetsWithTargetPath" ItemName="_PackStaticWebAssetWithTargetPath" />
193+
</ComputeStaticWebAssetsTargetPaths>
140194

141195
<ItemGroup>
142-
<StaticWebAssetPackageFile Include="$(IntermediateOutputPath)StaticWebAssets.targets">
196+
<StaticWebAssetPackageFile Include="$(IntermediateOutputPath)Assets.Pack.targets">
143197
<PackagePath>build\Microsoft.AspNetCore.StaticWebAssets.targets</PackagePath>
144198
</StaticWebAssetPackageFile>
145-
<StaticWebAssetPackageFile Include="$(IntermediateOutputPath)StaticWebAssets.endpoints.targets">
199+
<StaticWebAssetPackageFile Include="$(IntermediateOutputPath)Assets.Pack.endpoints.targets">
146200
<PackagePath>build\Microsoft.AspNetCore.StaticWebAssets.endpoints.targets</PackagePath>
147201
</StaticWebAssetPackageFile>
202+
<StaticWebAssetPackageFile Include="$(IntermediateOutputPath)Assets.Pack.debug.targets">
203+
<PackagePath>build\Microsoft.AspNetCore.StaticWebAssets.debug.targets</PackagePath>
204+
</StaticWebAssetPackageFile>
205+
<StaticWebAssetPackageFile Include="$(IntermediateOutputPath)Assets.Pack.debug.endpoints.targets">
206+
<PackagePath>build\Microsoft.AspNetCore.StaticWebAssets.debug.endpoints.targets</PackagePath>
207+
</StaticWebAssetPackageFile>
148208
</ItemGroup>
149209

150210
</Target>
Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
<Project>
2-
<Import Project="$(MSBuildThisFileDirectory)Microsoft.AspNetCore.StaticWebAssets.targets"/>
3-
<Import Project="$(MSBuildThisFileDirectory)Microsoft.AspNetCore.StaticWebAssets.endpoints.targets"/>
2+
<Import Project="$(MSBuildThisFileDirectory)Microsoft.AspNetCore.StaticWebAssets.targets" />
3+
<Import Project="$(MSBuildThisFileDirectory)Microsoft.AspNetCore.StaticWebAssets.endpoints.targets" />
4+
5+
<Import Project="$(MSBuildThisFileDirectory)Microsoft.AspNetCore.StaticWebAssets.debug.targets"
6+
Condition="'$(Configuration)' == 'Debug'" />
7+
<Import Project="$(MSBuildThisFileDirectory)Microsoft.AspNetCore.StaticWebAssets.debug.endpoints.targets"
8+
Condition="'$(Configuration)' == 'Debug'"/>
49
</Project>

0 commit comments

Comments
 (0)