Skip to content

Commit 7b42067

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 ab9f8d1 commit 7b42067

File tree

1 file changed

+40
-8
lines changed

1 file changed

+40
-8
lines changed

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

Lines changed: 40 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,17 @@
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.Runtime.csproj"
29+
Condition=" ! $(IsTargetingPackBuilding) "
30+
PrivateAssets="All"
31+
ReferenceOutputAssembly="false"
32+
SkipGetTargetFrameworkProperties="true" />
33+
<ProjectReference Include="$(RepoRoot)src\Framework\App.Ref\src\Microsoft.AspNetCore.App.Ref.csproj"
34+
Condition=" $(IsTargetingPackBuilding) "
35+
PrivateAssets="All"
36+
ReferenceOutputAssembly="false"
37+
SkipGetTargetFrameworkProperties="true" />
3138

3239
<Reference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" />
3340
<Compile Include="$(SharedSourceRoot)CommandLineUtils\**\*.cs" />
@@ -45,5 +52,30 @@
4552
<NuspecProperty Include="PackageThirdPartyNoticesFile=$(PackageThirdPartyNoticesFile)" />
4653
</ItemGroup>
4754

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

0 commit comments

Comments
 (0)