Skip to content

Commit 6fdf569

Browse files
committed
Get Components.WebAssembly.DevServer project building
- use the just-built Microsoft.AspNetCore.App - cannot use one from SDK _and_ reference Microsoft.AspNetCore.Components.WebAssembly.Server
1 parent f31d147 commit 6fdf569

File tree

1 file changed

+36
-8
lines changed

1 file changed

+36
-8
lines changed

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

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@
1313
<IsProjectReferenceProvider>false</IsProjectReferenceProvider>
1414

1515
<!--
16-
This project compiles against Microsoft.AspNetCore.App from the SDK.
17-
This ensures that it's packaging output is correct and does not include local artifacts.
16+
Act as if this project will compile against the Microsoft.AspNetCore.App from the SDK. This ensures that its
17+
packaging output is correct and does not include local artifacts. But, see last-minute fixup in the
18+
_UpdateSharedFrameworkAssemblies.target.
1819
-->
1920
<UseAspNetCoreSharedRuntime>true</UseAspNetCoreSharedRuntime>
2021
<DoNotApplyWorkaroundsToMicrosoftAspNetCoreApp>true</DoNotApplyWorkaroundsToMicrosoftAspNetCoreApp>
@@ -23,11 +24,12 @@
2324
<ItemGroup>
2425
<FrameworkReference Include="Microsoft.AspNetCore.App" />
2526

26-
<ProjectReference
27-
Include="$(RepoRoot)src\Framework\App.Runtime\src\Microsoft.AspNetCore.App.Runtime.csproj"
28-
PrivateAssets="All"
29-
ReferenceOutputAssembly="false"
30-
SkipGetTargetFrameworkProperties="true" />
27+
<!-- Ensure "just been built" is correct. -->
28+
<ProjectReference Include="$(RepoRoot)src\Framework\App.Ref\src\Microsoft.AspNetCore.App.Ref.csproj"
29+
Condition=" $(IsTargetingPackBuilding) "
30+
PrivateAssets="All"
31+
ReferenceOutputAssembly="false"
32+
SkipGetTargetFrameworkProperties="true" />
3133

3234
<Reference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" />
3335
<Compile Include="$(SharedSourceRoot)CommandLineUtils\**\*.cs" />
@@ -45,5 +47,31 @@
4547
<NuspecProperty Include="PackageThirdPartyNoticesFile=$(PackageThirdPartyNoticesFile)" />
4648
</ItemGroup>
4749

48-
50+
<!--
51+
As versioning changes, cannot compile against both the ASP.NET runtime / ref assemblies in the SDK e.g. a 5.0 SDK
52+
and Microsoft.AspNetCore.Components.WebAssembly.Server (which would be 6.0 in this example). Ensure we build using
53+
the targeting pack that's just been built.
54+
-->
55+
<Target Name="_UpdateSharedFrameworkAssemblies"
56+
AfterTargets="ResolveFrameworkReferences"
57+
BeforeTargets="ResolveTargetingPackAssets;_PrepareForReadyToRunCompilation;ResolveFrameworkReferencesDesignTime;_WarnAboutRedundantRef"
58+
Condition=" $(IsTargetingPackBuilding) "
59+
DependsOnTargets="ResolveFrameworkReferences">
60+
<PropertyGroup>
61+
<_PreviousTargetingPackVersion>@(ResolvedTargetingPack->WithMetadataValue('Identity', 'Microsoft.AspNetCore.App')->'%(NuGetPackageVersion)')</_PreviousTargetingPackVersion>
62+
<_PreviousTargetingPackPath>@(ResolvedTargetingPack->WithMetadataValue('Identity', 'Microsoft.AspNetCore.App')->'%(PackageDirectory)')</_PreviousTargetingPackPath>
63+
<_NewTargetingPackPath>$(_PreviousTargetingPackPath.Replace('$(_PreviousTargetingPackVersion)', '$(TargetingPackVersion)'))</_NewTargetingPackPath>
64+
</PropertyGroup>
65+
<ItemGroup Condition=" EXISTS('$(_NewTargetingPackPath)') ">
66+
<ResolvedFrameworkReference Condition=" '%(Identity)' == 'Microsoft.AspNetCore.App' ">
67+
<TargetingPackVersion>$(TargetingPackVersion)</TargetingPackVersion>
68+
<TargetingPackPath>$(_NewTargetingPackPath)</TargetingPackPath>
69+
</ResolvedFrameworkReference>
70+
<ResolvedTargetingPack Condition=" '%(Identity)' == 'Microsoft.AspNetCore.App' ">
71+
<NuGetPackageVersion>$(TargetingPackVersion)</NuGetPackageVersion>
72+
<PackageDirectory>$(_NewTargetingPackPath)</PackageDirectory>
73+
<Path>$(_NewTargetingPackPath)</Path>
74+
</ResolvedTargetingPack>
75+
</ItemGroup>
76+
</Target>
4977
</Project>

0 commit comments

Comments
 (0)