Skip to content

Commit 5ff734d

Browse files
committed
Cross-compile the tasks dll
1 parent 517a1cb commit 5ff734d

File tree

3 files changed

+22
-11
lines changed

3 files changed

+22
-11
lines changed

src/Components/Blazor/Build/src/Microsoft.AspNetCore.Blazor.Build.csproj

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netstandard2.0</TargetFramework>
4+
<TargetFrameworks>$(DefaultNetCoreTargetFramework);net46</TargetFrameworks>
55
<TargetName>Microsoft.AspNetCore.Blazor.Build.Tasks</TargetName>
66
<AssemblyName>Microsoft.AspNetCore.Blazor.Build</AssemblyName>
77
<Description>Build mechanism for ASP.NET Core Blazor applications.</Description>
88
<IsShippingPackage>true</IsShippingPackage>
99
<HasReferenceAssembly>false</HasReferenceAssembly>
10-
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
10+
<GenerateDependencyFile>false</GenerateDependencyFile>
1111
</PropertyGroup>
1212

1313
<!-- Pack settings -->
@@ -27,13 +27,17 @@
2727
</ItemGroup>
2828

2929
<ItemGroup>
30-
<ProjectReference Condition="'$(BuildNodeJS)' != 'false' and '$(BuildingInsideVisualStudio)' != 'true'" Include="$(RepoRoot)src\Components\Web.JS\Microsoft.AspNetCore.Components.Web.JS.npmproj" ReferenceOutputAssembly="false" />
31-
<Reference Include="Microsoft.Build.Framework" PrivateAssets="All" />
32-
<Reference Include="Microsoft.Build.Utilities.Core" PrivateAssets="All" />
33-
<Reference Include="System.Reflection.Metadata" />
30+
<ProjectReference Condition="'$(BuildNodeJS)' != 'false' and '$(BuildingInsideVisualStudio)' != 'true'"
31+
Include="$(RepoRoot)src\Components\Web.JS\Microsoft.AspNetCore.Components.Web.JS.npmproj"
32+
ReferenceOutputAssembly="false"
33+
SkipGetTargetFrameworkProperties="true"
34+
UndefineProperties="TargetFramework" />
35+
<Reference Include="Microsoft.Build.Framework" ExcludeAssets="Runtime" />
36+
<Reference Include="Microsoft.Build.Utilities.Core" ExcludeAssets="Runtime" />
37+
<Reference Include="System.Reflection.Metadata" Condition="'$(TargetFramework)' == 'net46'" />
3438
</ItemGroup>
3539

36-
<Target Name="CopyBuildTask" BeforeTargets="Build" AfterTargets="PrepareForRun">
40+
<Target Name="CopyBuildTask" BeforeTargets="Build" Condition="'$(IsInnerBuild)' != 'true'">
3741
<!--
3842
The task produced by this project is referenced within this solution. When building, Visual Studio will lock up the assembly.
3943
Any attempts to overwrite the binary with a newer version will fail. This is particularly grating if a developer "Rebuilds" the project
@@ -46,10 +50,15 @@
4650
-->
4751

4852
<ItemGroup>
49-
<_FilesToCopy Include="$(OutputPath)*.*" />
53+
<_NetCoreFilesToCopy Include="$(OutputPath)$(DefaultNetCoreTargetFramework)\*" TargetPath="netcoreapp\" />
54+
<_DesktopFilesToCopy Include="$(OutputPath)net46\*.*" TargetPath="netfx\" />
55+
<_AllFilesToCopy Include="@(_NetCoreFilesToCopy);@(_DesktopFilesToCopy)" />
5056
</ItemGroup>
5157

52-
<Copy SourceFiles="@(_FilesToCopy)" DestinationFolder="$(OutputPath)tools" SkipUnchangedFiles="true" Retries="1" ContinueOnError="true">
58+
<Error Text="No files found in $(OutputPath)$(DefaultNetCoreTargetFramework)" Condition="@(_NetCoreFilesToCopy->Count()) == 0" />
59+
<Error Text="No files found in $(OutputPath)net46" Condition="@(_DesktopFilesToCopy->Count()) == 0" />
60+
61+
<Copy SourceFiles="@(_AllFilesToCopy)" DestinationFiles="@(_AllFilesToCopy->'$(OutputPath)tools\%(TargetPath)%(FileName)%(Extension)')" SkipUnchangedFiles="true" Retries="1" ContinueOnError="true">
5362
<Output TaskParameter="CopiedFiles" ItemName="FileWrites" />
5463
</Copy>
5564
</Target>

src/Components/Blazor/Build/src/ReferenceBlazorBuildFromSource.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<ComponentsRoot Condition="'$(ComponentsRoot)'==''">$(MSBuildThisFileDirectory)..\..\..\</ComponentsRoot>
1313
<BlazorJsPath>$(ComponentsRoot)Web.JS\dist\$(Configuration)\blazor.webassembly.js</BlazorJsPath>
1414
<BlazorJsMapPath>$(ComponentsRoot)Web.JS\dist\$(Configuration)\blazor.webassembly.js.map</BlazorJsMapPath>
15-
<BlazorToolsDir>$(MSBuildThisFileDirectory)bin\$(Configuration)\netstandard2.0\tools\</BlazorToolsDir>
15+
<BlazorToolsDir>$(MSBuildThisFileDirectory)bin\$(Configuration)\tools\</BlazorToolsDir>
1616
</PropertyGroup>
1717

1818
<Target Name="CheckBlazorJSFiles" BeforeTargets="Build">

src/Components/Blazor/Build/src/targets/All.targets

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77

88
<PropertyGroup>
99
<BlazorToolsDir Condition="'$(BlazorToolsDir)' == ''">$(MSBuildThisFileDirectory)..\tools\</BlazorToolsDir>
10-
<BlazorTasksPath>$(BlazorToolsDir)Microsoft.AspNetCore.Blazor.Build.Tasks.dll</BlazorTasksPath>
10+
<_BlazorTasksTFM Condition=" '$(MSBuildRuntimeType)' == 'Core'">netcoreapp</_BlazorTasksTFM>
11+
<_BlazorTasksTFM Condition=" '$(_BlazorTasksTFM)' == ''">netfx</_BlazorTasksTFM>
12+
<BlazorTasksPath>$(BlazorToolsDir)$(_BlazorTasksTFM)\Microsoft.AspNetCore.Blazor.Build.Tasks.dll</BlazorTasksPath>
1113

1214
<!-- The Blazor build code can only find your referenced assemblies if they are in the output directory -->
1315
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>

0 commit comments

Comments
 (0)