Skip to content

Commit 197bf19

Browse files
authored
Add .Net 7 Check to ClientAssets (#572)
* Prevent .NET7 from falling back to old behavior * change to '<', '>=' * Stop comparing strings :( * Add project capability
1 parent 86eedec commit 197bf19

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/ClientAssets/Microsoft.AspNetCore.ClientAssets/build/netstandard2.0/Microsoft.AspNetCore.ClientAssets.targets

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
<ItemGroup>
2020
<ClientAssetsInputs Include="$(ClientAssetsDirectory)**" Exclude="$(DefaultItemExcludes)" />
21+
<ProjectCapability Include="ClientAssetsAlpha"/>
2122
</ItemGroup>
2223

2324
<Target Name="ClientAssetsRestore" BeforeTargets="$(ClientAssetsRestoreBeforeTargets)" Inputs="$(ClientAssetsRestoreInputs)" Outputs="$(ClientAssetsRestoreOutputs)">
@@ -47,7 +48,7 @@
4748
<FileWrites Include="$(IntermediateOutputPath)clientassetsbuild.complete.txt" />
4849

4950
<Content
50-
Condition="'$(TargetFramework)' != 'net6.0'"
51+
Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp' AND $([MSBuild]::VersionLessThan('$(TargetFrameworkVersion)', '6.0')) "
5152
Include="@(_ClientAssetsBuildOutput)"
5253
Link="wwwroot\%(_ClientAssetsBuildOutput.RecursiveDir)\%(_ClientAssetsBuildOutput.FileName)%(_ClientAssetsBuildOutput.Extension)" />
5354

@@ -58,7 +59,7 @@
5859
the ability to consume them from project references. As a workaround, we are using the Task directly on this package, to make sure this scenario works. In a future
5960
release we will address this by aligning DiscoverStaticWebAssets behavior with DefineStaticWebAssets to follow the same heuristics for determining the content root.
6061
-->
61-
<DefineStaticWebAssets Condition="'$(TargetFramework)' == 'net6.0'"
62+
<DefineStaticWebAssets Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp' AND $([MSBuild]::VersionGreaterThanOrEquals('$(TargetFrameworkVersion)', '6.0'))"
6263
CandidateAssets="@(_ClientAssetsBuildOutput)"
6364
SourceId="$(PackageId)"
6465
SourceType="Computed"

0 commit comments

Comments
 (0)