Skip to content

Commit b6c411f

Browse files
authored
[release/3.1] Minor cleanup (#33419)
* !nit! Do not use `pwsh` aliases - take VS Code suggestions * !nit! Remove minor infra differences from 'main' - mostly comment and whitespace cleanup - work toward making comparisons more meaningful * Clean up warnings about EOL TFMs - move to non-EOL TFM in Ignitor; not a shipping project - suppress NETSDK1138 warnings in KeyDerivation project * !nit! Remove dangling project reference - 6c16632 removed ProjectTemplates/ComponentsWebAssembly.ProjectTemplates/ folder
1 parent 922fd4b commit b6c411f

File tree

6 files changed

+42
-35
lines changed

6 files changed

+42
-35
lines changed

eng/Build.props

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
$(RepoRoot)src\SignalR\clients\ts\**\node_modules\**\*.*proj;
3636
$(RepoRoot)src\Components\Web.JS\node_modules\**\*.*proj;
3737
$(RepoRoot)src\Components\WebAssembly\Build\testassets\**\*.csproj;
38-
$(RepoRoot)src\ProjectTemplates\ComponentsWebAssembly.ProjectTemplates\content\**\*.csproj;
3938
$(RepoRoot)src\ProjectTemplates\Web.ProjectTemplates\content\**\*.csproj;
4039
$(RepoRoot)src\ProjectTemplates\Web.ProjectTemplates\content\**\*.fsproj;
4140
$(RepoRoot)src\ProjectTemplates\Web.Spa.ProjectTemplates\content\**\*.csproj;

eng/CodeGen.proj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
Targets="GetReferencesProvided"
1616
BuildInParallel="true"
1717
SkipNonexistentTargets="true"
18-
SkipNonexistentProjects="true" >
19-
<Output TaskParameter="TargetOutputs" ItemName="_ProjectReferenceProvider"/>
18+
SkipNonexistentProjects="true">
19+
<Output TaskParameter="TargetOutputs" ItemName="_ProjectReferenceProvider" />
2020
</MSBuild>
2121

2222
<ItemGroup>

eng/scripts/CodeCheck.ps1

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ try {
6666
# Ignore duplicates in submodules. These should be isolated from the rest of the build.
6767
# Ignore duplicates in the .ref folder. This is expected.
6868
Get-ChildItem -Recurse "$repoRoot/src/*.*proj" `
69-
| ? { $_.FullName -notmatch 'submodules' -and $_.FullName -notmatch 'node_modules' } `
70-
| ? { (Split-Path -Leaf (Split-Path -Parent $_)) -ne 'ref' } `
71-
| % {
69+
| Where-Object { $_.FullName -notmatch 'submodules' -and $_.FullName -notmatch 'node_modules' } `
70+
| Where-Object { (Split-Path -Leaf (Split-Path -Parent $_)) -ne 'ref' } `
71+
| ForEach-Object {
7272
$fileName = [io.path]::GetFileNameWithoutExtension($_)
7373
if (-not ($projectFileNames.Add($fileName))) {
7474
LogError -code 'BUILD003' -filepath $_ `
@@ -136,17 +136,17 @@ try {
136136
Write-Host "Checking that solutions are up to date"
137137

138138
Get-ChildItem "$repoRoot/*.sln" -Recurse `
139-
| ? {
139+
| Where-Object {
140140
# These .sln files are used by the templating engine.
141141
(($_.Name -ne "BlazorServerWeb_CSharp.sln") -and ($_.Name -ne 'ComponentsWebAssembly-CSharp.sln'))
142142
} `
143-
| % {
143+
| ForEach-Object {
144144
Write-Host " Checking $(Split-Path -Leaf $_)"
145145
$slnDir = Split-Path -Parent $_
146146
$sln = $_
147147
& dotnet sln $_ list `
148-
| ? { $_ -like '*proj' } `
149-
| % {
148+
| Where-Object { $_ -like '*proj' } `
149+
| ForEach-Object {
150150
$proj = Join-Path $slnDir $_
151151
if (-not (Test-Path $proj)) {
152152
LogError "Missing project. Solution references a project which does not exist: $proj. [$sln] "

eng/targets/ResolveReferences.targets

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
<Project>
2121

2222
<PropertyGroup>
23-
<EnableCustomReferenceResolution Condition="'$(EnableCustomReferenceResolution)' == '' AND ('$(DotNetBuildFromSource)' != 'true' OR '$(ExcludeFromSourceBuild)' != 'true')">true</EnableCustomReferenceResolution>
23+
<EnableCustomReferenceResolution
24+
Condition="'$(EnableCustomReferenceResolution)' == '' AND ('$(DotNetBuildFromSource)' != 'true' OR '$(ExcludeFromSourceBuild)' != 'true')">true</EnableCustomReferenceResolution>
2425

2526
<ResolveReferencesDependsOn>
2627
ResolveCustomReferences;
@@ -35,10 +36,11 @@
3536
* when a project is a test or sample project
3637
* when a package is releasing a new patch (we like to update external dependencies in patches when possible)
3738
That is, use latest package references unless this is a servicing build, the project is normally packable, and
38-
the package is not included in this release.
39+
the package is not included in this release. The "unless" cases are extremely unlikely because both
40+
$(IsPackableInNonServicingBuild) and $(IsPackageInThisPatch) are either undefined or true.
3941
-->
4042
<UseLatestPackageReferences
41-
Condition=" '$(UseLatestPackageReferences)' == '' AND '$(IsServicingBuild)' != 'true' ">true</UseLatestPackageReferences>
43+
Condition=" '$(UseLatestPackageReferences)' == '' AND '$(IsServicingBuild)' != 'true' ">true</UseLatestPackageReferences>
4244
<UseLatestPackageReferences
4345
Condition=" '$(UseLatestPackageReferences)' == '' AND '$(IsPackableInNonServicingBuild)' != 'true' ">true</UseLatestPackageReferences>
4446
<UseLatestPackageReferences
@@ -99,8 +101,8 @@
99101
<_OriginalReferences Include="@(Reference)" />
100102

101103
<!--
102-
Turn Reference items into a ProjectReference when UseProjectReferences is true.
103-
Order matters. This comes before package resolution because projects should be used when possible instead of packages.
104+
Turn Reference items into a ProjectReference when UseProjectReferences is true. Order matters; this
105+
comes before package resolution because projects should be used when possible instead of packages.
104106
-->
105107
<_ProjectReferenceByAssemblyName Condition="'$(UseProjectReferences)' == 'true'"
106108
Include="@(ProjectReferenceProvider)"
@@ -121,16 +123,13 @@
121123
</ItemGroup>
122124

123125
<!--
124-
This target helps ensure projects within the shared framework do not unintentionally add new references,
125-
and that assemblies outside the shared framework reference the framework as a whole instead of using
126-
individual assemblies.
126+
This target helps ensure projects within the shared framework do not unintentionally add new references, and that
127+
assemblies outside the shared framework reference the framework as a whole instead of using individual assemblies.
128+
In addition, enforce use of Reference items for projects reference providers.
127129
-->
128130
<Target Name="_CheckForReferenceBoundaries" BeforeTargets="CollectPackageReferences;ResolveReferences">
129-
<Error Condition="@(_InvalidReferenceToSharedFxOnlyAssembly->Count()) != 0"
130-
Text="Cannot reference &quot;%(_InvalidReferenceToSharedFxOnlyAssembly.Identity)&quot; directly because it is part of the shared framework and this project is not. Use &lt;FrameworkReference Include=&quot;Microsoft.AspNetCore.App&quot; /&gt; instead." />
131-
132131
<Error Condition="@(_InvalidReferenceToNonSharedFxAssembly->Count()) != 0"
133-
Text="Cannot reference &quot;%(_InvalidReferenceToNonSharedFxAssembly.Identity)&quot;. This dependency is not in the shared framework. See docs/SharedFramework.md for instructions on how to modify what is in the shared framework." />
132+
Text="Cannot reference &quot;%(Identity)&quot;. This dependency is not in the shared framework. See docs/SharedFramework.md for instructions on how to modify what is in the shared framework." />
134133
</Target>
135134

136135
<Target Name="_WarnAboutRedundantRef" AfterTargets="ResolveFrameworkReferences;ProcessFrameworkReferences">
@@ -140,14 +139,15 @@
140139
</Target>
141140

142141
<!--
143-
This target resolves remaining Reference items to Packages, if possible. If not, they are left as Reference items fo the SDK to resolve.
144-
This executes on NuGet restore and during DesignTimeBuild. It should not run in the outer, cross-targeting build.
142+
This target resolves remaining Reference items to Packages, if possible. If not, they are left as Reference
143+
items for the SDK to resolve. This executes on NuGet restore and during DesignTimeBuild. It should not run in
144+
outer, cross-targeting build.
145145
-->
146146
<Target Name="ResolveCustomReferences"
147147
BeforeTargets="CheckForImplicitPackageReferenceOverrides;CollectPackageReferences;ResolvePackageAssets"
148148
Condition=" '$(TargetFramework)' != '' AND '$(EnableCustomReferenceResolution)' == 'true' ">
149149
<ItemGroup>
150-
<!-- Ensure only content asset are consumed from .Sources packages -->
150+
<!-- Ensure only content assets are consumed from .Sources packages. -->
151151
<Reference>
152152
<IncludeAssets Condition="'%(IsSharedSource)' == 'true'">ContentFiles;Build</IncludeAssets>
153153
<PrivateAssets Condition="'%(IsSharedSource)' == 'true'">All</PrivateAssets>
@@ -176,9 +176,9 @@
176176
<_LatestPackageReferenceWithVersion Remove="@(_LatestPackageReferenceWithVersion)"
177177
Condition="'%(Id)' != '%(Identity)' " />
178178

179+
<PackageReference Include="@(_LatestPackageReferenceWithVersion)" IsImplicitlyDefined="true" />
179180
<!-- Remove reference items that have been resolved to a LatestPackageReference item. -->
180181
<Reference Remove="@(_LatestPackageReferenceWithVersion)" />
181-
<PackageReference Include="@(_LatestPackageReferenceWithVersion)" IsImplicitlyDefined="true" />
182182

183183
<!-- Resolve references from BaselinePackageReference for servicing builds in corner cases. May be unused. -->
184184
<_BaselinePackageReferenceWithVersion Include="@(Reference)"
@@ -189,8 +189,8 @@
189189
<_BaselinePackageReferenceWithVersion Remove="@(_BaselinePackageReferenceWithVersion)"
190190
Condition="'%(Id)' != '%(Identity)' " />
191191

192-
<!-- Remove reference items that have been resolved to a BaselinePackageReference item. -->
193192
<PackageReference Include="@(_BaselinePackageReferenceWithVersion)" IsImplicitlyDefined="true" />
193+
<!-- Remove reference items that have been resolved to a BaselinePackageReference item. -->
194194
<Reference Remove="@(_BaselinePackageReferenceWithVersion)" />
195195

196196
<!-- For PrivateAssets=All references, like .Sources packages, fallback to LatestPackageReferences. -->
@@ -201,8 +201,8 @@
201201
<_PrivatePackageReferenceWithVersion Remove="@(_PrivatePackageReferenceWithVersion)"
202202
Condition="'%(Id)' != '%(Identity)' " />
203203

204-
<!-- Remove reference items that have been resolved to an item with PrivateAssets="All". -->
205204
<PackageReference Include="@(_PrivatePackageReferenceWithVersion)" IsImplicitlyDefined="true" />
205+
<!-- Remove reference items that have been resolved to an item with PrivateAssets="All". -->
206206
<Reference Remove="@(_PrivatePackageReferenceWithVersion)" />
207207

208208
<!-- Free up memory for unnecessary items -->
@@ -228,7 +228,7 @@
228228
<Error
229229
Condition="'$(IsReferenceAssemblyProject)' != 'true' AND '$(IsServicingBuild)' == 'true' AND @(UnusedBaselinePackageReference->Count()) != 0"
230230
Code="BUILD002"
231-
Text="Package references changed since the last release. This could be a breaking change and is not allowed in a servicing update. References removed:%0A - @(UnusedBaselinePackageReference, '%0A -')" />
231+
Text="Package references changed since the last release. This could be a breaking change and is not allowed in a servicing update. References removed:%0A - @(UnusedBaselinePackageReference, '%0A - ')" />
232232

233233
<Error
234234
Condition="'$(TargetFrameworkIdentifier)' != '.NETFramework' AND '%(Reference.Identity)' != '' AND ! Exists('%(Reference.Identity)') AND '$(DisablePackageReferenceRestrictions)' != 'true'"
@@ -339,11 +339,12 @@
339339
Condition="'$(SkipRefDirectoryCheck)' != 'true' AND '$(IsImplementationProject)' == 'true' AND !$(HasReferenceAssembly) AND Exists($(ReferenceAssemblyDirectory))"
340340
Text="Project shouldn't have reference assembly but folder exists $(ReferenceAssemblyDirectory)" />
341341
<Error
342-
Condition=" '$(IsAspNetCoreApp)' == 'true' AND '$(IsImplementationProject)' == 'true' AND !$(HasReferenceAssembly) "
343-
Text="All assemblies which have set IsAspNetCoreApp=true should produce a reference assembly." />
344-
<Warning Condition=" '$(IsAspNetCoreApp)' == 'true' AND '$(IsImplementationProject)' != 'true' "
342+
Condition=" '$(IsAspNetCoreApp)' == 'true' AND '$(IsImplementationProject)' == 'true' AND
343+
!$(HasReferenceAssembly) AND '$(TargetFramework)' == '$(DefaultNetCoreTargetFramework)' "
344+
Text="All assemblies which have set IsAspNetCoreApp=true should produce a reference assembly for default TFM." />
345+
<Error Condition=" '$(IsAspNetCoreApp)' == 'true' AND '$(IsImplementationProject)' != 'true' "
345346
Text="Only implementation projects should set IsAspNetCoreApp=true." />
346-
<Warning Condition=" '$(IsAspNetCoreApp)' != 'true' AND $(HasReferenceAssembly) "
347+
<Error Condition=" '$(IsAspNetCoreApp)' != 'true' AND $(HasReferenceAssembly) "
347348
Text="Only projects in the shared framework i.e. IsAspNetCoreApp==true should produce a reference assembly." />
348349

349350
<ItemGroup Condition=" '$(IsProjectReferenceProvider)' == 'true' ">

src/Components/Ignitor/src/Ignitor.csproj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<!-- Intentionally targeting netcoreapp3.0 because we do not want to update the Benchmark client to use 3.1 -->
5-
<TargetFramework>netcoreapp3.0</TargetFramework>
4+
<TargetFramework>netcoreapp3.1</TargetFramework>
65
<IsPackable>true</IsPackable>
76
<IsShippingPackage>false</IsShippingPackage>
87
<HasReferenceAssembly>false</HasReferenceAssembly>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<Project>
2+
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory)..\, Directory.Build.props))\Directory.Build.props" />
3+
4+
<PropertyGroup>
5+
<!-- We know netcoreapp2.0 is EOL but can't take a breaking change in shipped package. -->
6+
<CheckEolTargetFramework>false</CheckEolTargetFramework>
7+
</PropertyGroup>
8+
</Project>

0 commit comments

Comments
 (0)