Skip to content

Commit 0b0bed3

Browse files
authored
Expose all references when not restoring (#32718)
* Expose all references when not restoring - use empty `$(MSBuildRestoreSessionId)` to determine when contributing to dependency graph * Remove extra direct references - should now be part of the dependency graph automatically * Avoid errors about non-shared Fx references - not a problem unless executing `restore` target * Special case source builds
1 parent 49d58b1 commit 0b0bed3

File tree

35 files changed

+24
-67
lines changed

35 files changed

+24
-67
lines changed

eng/targets/ResolveReferences.targets

+4-1
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,11 @@
110110
In addition, enforce use of Reference items for projects reference providers.
111111
-->
112112
<Target Name="_CheckForReferenceBoundaries" BeforeTargets="CollectPackageReferences;ResolveReferences">
113+
<!-- Dependency graph checks may include unexpected packages. Ignore this because it's not an error. -->
113114
<Error
114-
Condition="@(_InvalidReferenceToNonSharedFxAssembly->Count()) != 0 AND '$(TargetFramework)' == '$(DefaultNetCoreTargetFramework)'"
115+
Condition=" '$(TargetFramework)' == '$(DefaultNetCoreTargetFramework)' AND
116+
'$(MSBuildRestoreSessionId)' != '' AND
117+
@(_InvalidReferenceToNonSharedFxAssembly->Count()) != 0 "
115118
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." />
116119

117120
<Error

src/Components/Ignitor/src/Ignitor.csproj

-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@
3232
<Reference Include="Microsoft.AspNetCore.SignalR.Client" />
3333
<Reference Include="Microsoft.AspNetCore.SignalR.Protocols.MessagePack" />
3434
<Reference Include="Microsoft.Extensions.Logging.Console" />
35-
<!-- Avoid CS1705 errors due to mix of assemblies brought in transitively. -->
36-
<Reference Include="Microsoft.AspNetCore.SignalR.Common" />
3735
</ItemGroup>
3836

3937
<ItemGroup>

src/Components/WebAssembly/testassets/Wasm.Authentication.Server/Wasm.Authentication.Server.csproj

-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
<PropertyGroup>
44
<TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework>
5-
<!-- Avoid CS1705 errors due to mix of assemblies brought in transitively. -->
65

76
<!-- This project references the shared framework transitively. Prevent restore errors by setting this flag. -->
87
<GenerateErrorForMissingTargetingPacks>false</GenerateErrorForMissingTargetingPacks>
@@ -21,7 +20,6 @@
2120
<Reference Include="Microsoft.EntityFrameworkCore.Relational" />
2221
<Reference Include="Microsoft.EntityFrameworkCore.SQLite" />
2322
<Reference Include="Microsoft.Extensions.Hosting" />
24-
2523
</ItemGroup>
2624

2725
<ItemGroup>

src/DataProtection/DataProtection/src/Microsoft.AspNetCore.DataProtection.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@
3030
<Reference Include="System.Security.Cryptography.Xml" />
3131
</ItemGroup>
3232

33-
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
33+
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0' OR '$(MSBuildRestoreSessionId)' == ''">
3434
<Reference Include="System.Security.Principal.Windows" />
3535
</ItemGroup>
3636

37-
<ItemGroup Condition="'$(TargetFramework)' == '$(DefaultNetFxTargetFramework)'">
37+
<ItemGroup Condition="'$(TargetFramework)' == '$(DefaultNetFxTargetFramework)' OR '$(MSBuildRestoreSessionId)' == ''">
3838
<Reference Include="System.Runtime.InteropServices.RuntimeInformation" />
3939
</ItemGroup>
4040

src/DataProtection/EntityFrameworkCore/test/Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.Test.csproj

-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
<ItemGroup>
88
<Reference Include="Microsoft.AspNetCore.DataProtection.EntityFrameworkCore" />
99
<Reference Include="Microsoft.EntityFrameworkCore.InMemory" />
10-
<!-- Avoid CS1705 errors due to mix of assemblies brought in transitively. -->
11-
<Reference Include="Microsoft.AspNetCore.DataProtection" />
1210
</ItemGroup>
1311

1412
</Project>

src/DataProtection/StackExchangeRedis/test/Microsoft.AspNetCore.DataProtection.StackExchangeRedis.Tests.csproj

-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616
<Reference Include="Microsoft.Extensions.Configuration.Json" />
1717
<Reference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" />
1818
<Reference Include="Microsoft.Extensions.DependencyInjection" />
19-
<!-- Avoid CS1705 errors due to mix of assemblies brought in transitively. -->
20-
<Reference Include="Microsoft.AspNetCore.DataProtection" />
2119
</ItemGroup>
2220

2321
</Project>

src/DataProtection/samples/EntityFrameworkCoreSample/EntityFrameworkCoreSample.csproj

-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
<Reference Include="Microsoft.EntityFrameworkCore.SqlServer" />
1212
<Reference Include="Microsoft.Extensions.DependencyInjection" />
1313
<Reference Include="Microsoft.Extensions.Logging.Console" />
14-
<!-- Avoid CS1705 errors due to mix of assemblies brought in transitively. -->
15-
<Reference Include="Microsoft.Extensions.DependencyInjection.Abstractions" />
1614
</ItemGroup>
1715

1816
</Project>

src/DataProtection/samples/Redis/Redis.csproj

-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010
<Reference Include="Microsoft.Extensions.DependencyInjection" />
1111
<Reference Include="Microsoft.Extensions.Logging" />
1212
<Reference Include="Microsoft.Extensions.Logging.Console" />
13-
<!-- Avoid CS1705 errors due to mix of assemblies brought in transitively. -->
14-
<Reference Include="Microsoft.AspNetCore.DataProtection" />
1513
</ItemGroup>
1614

1715
</Project>

src/Identity/ApiAuthorization.IdentityServer/samples/ApiAuthSample/ApiAuthSample.csproj

-2
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@
3535
<Reference Include="Microsoft.Extensions.Logging.Configuration" />
3636
<Reference Include="Microsoft.Extensions.Logging.Console" />
3737
<Reference Include="Microsoft.Extensions.Logging.Debug" />
38-
<!-- Avoid CS1705 errors due to mix of assemblies brought in transitively. -->
39-
<Reference Include="Microsoft.Extensions.DependencyInjection.Abstractions" />
4038
</ItemGroup>
4139

4240
</Project>

src/Identity/EntityFrameworkCore/test/EF.InMemory.Test/Microsoft.AspNetCore.Identity.EntityFrameworkCore.InMemory.Test.csproj

-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
<Reference Include="Microsoft.AspNetCore.Hosting" />
1616
<Reference Include="Microsoft.AspNetCore.Http" />
1717
<Reference Include="Microsoft.EntityFrameworkCore.Sqlite" />
18-
<!-- Avoid CS1705 errors due to mix of assemblies brought in transitively. -->
19-
<Reference Include="Microsoft.Extensions.DependencyInjection.Abstractions" />
2018
</ItemGroup>
2119

2220
</Project>

src/Identity/EntityFrameworkCore/test/EF.Test/Microsoft.AspNetCore.Identity.EntityFrameworkCore.Test.csproj

-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
<Reference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" />
2121
<Reference Include="Microsoft.Extensions.Configuration.FileExtensions" />
2222
<Reference Include="Microsoft.Extensions.Configuration.Json" />
23-
<!-- Avoid CS1705 errors due to mix of assemblies brought in transitively. -->
24-
<Reference Include="Microsoft.Extensions.DependencyInjection.Abstractions" />
2523
</ItemGroup>
2624

2725
</Project>

src/Identity/Extensions.Core/src/Microsoft.Extensions.Identity.Core.csproj

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
<Reference Include="Microsoft.Extensions.Options" />
1717
</ItemGroup>
1818

19-
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0' OR '$(TargetFramework)' == '$(DefaultNetFxTargetFramework)'">
19+
<ItemGroup
20+
Condition="'$(TargetFramework)' == 'netstandard2.0' OR '$(TargetFramework)' == '$(DefaultNetFxTargetFramework)' OR '$(MSBuildRestoreSessionId)' == ''">
2021
<Reference Include="System.ComponentModel.Annotations" />
2122
</ItemGroup>
2223

src/Identity/samples/IdentitySample.DefaultUI/IdentitySample.DefaultUI.csproj

-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@
3131
<Reference Include="Microsoft.Extensions.Hosting" />
3232
<Reference Include="Microsoft.Extensions.Logging.Console" />
3333
<Reference Include="Microsoft.Extensions.Logging.Debug" />
34-
<!-- Avoid CS1705 errors due to mix of assemblies brought in transitively. -->
35-
<Reference Include="Microsoft.Extensions.DependencyInjection.Abstractions" />
3634
</ItemGroup>
3735

3836
<ItemGroup>

src/Identity/samples/IdentitySample.Mvc/IdentitySample.Mvc.csproj

-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,5 @@
2727
<Reference Include="Microsoft.Extensions.Configuration.UserSecrets" />
2828
<Reference Include="Microsoft.Extensions.Logging.Console" />
2929
<Reference Include="Microsoft.Extensions.Logging.Debug" />
30-
<!-- Avoid CS1705 errors due to mix of assemblies brought in transitively. -->
31-
<Reference Include="Microsoft.Extensions.DependencyInjection.Abstractions" />
3230
</ItemGroup>
3331
</Project>

src/Identity/testassets/Identity.DefaultUI.WebSite/Identity.DefaultUI.WebSite.csproj

-2
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@
4242
<Reference Include="Microsoft.Extensions.Logging.Configuration" />
4343
<Reference Include="Microsoft.Extensions.Logging.Console" />
4444
<Reference Include="Microsoft.Extensions.Logging.Debug" />
45-
<!-- Avoid CS1705 errors due to mix of assemblies brought in transitively. -->
46-
<Reference Include="Microsoft.Extensions.DependencyInjection.Abstractions" />
4745
</ItemGroup>
4846

4947
<PropertyGroup>

src/Logging.AzureAppServices/src/Microsoft.Extensions.Logging.AzureAppServices.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<Reference Include="System.ValueTuple" />
2222
</ItemGroup>
2323

24-
<ItemGroup Condition="'$(TargetFramework)' == '$(DefaultNetFxTargetFramework)'">
24+
<ItemGroup Condition="'$(TargetFramework)' == '$(DefaultNetFxTargetFramework)' OR '$(MSBuildRestoreSessionId)' == ''">
2525
<Reference Include="System.Net.Http" />
2626
</ItemGroup>
2727

src/Middleware/Diagnostics.EntityFrameworkCore/test/FunctionalTests/Diagnostics.EFCore.FunctionalTests.csproj

-3
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@
1010
<Reference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" />
1111
<Reference Include="Microsoft.AspNetCore.TestHost" />
1212
<Reference Include="Microsoft.EntityFrameworkCore.Sqlite" />
13-
<!-- Avoid CS1705 errors due to mix of assemblies brought in transitively. -->
14-
<Reference Include="Microsoft.Extensions.DependencyInjection.Abstractions" />
15-
<Reference Include="Microsoft.Extensions.Logging.Abstractions" />
1613
</ItemGroup>
1714

1815
</Project>

src/Middleware/Diagnostics.EntityFrameworkCore/test/UnitTests/Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.Tests.csproj

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
<Reference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" />
99
<Reference Include="Microsoft.AspNetCore.Http" />
1010
<Reference Include="Microsoft.EntityFrameworkCore.InMemory" />
11-
<!-- Avoid CS1705 errors due to mix of assemblies brought in transitively. -->
12-
<Reference Include="Microsoft.Extensions.DependencyInjection.Abstractions" />
1311
</ItemGroup>
1412

1513

src/Middleware/Diagnostics/test/testassets/DatabaseErrorPageSample/DatabaseErrorPageSample.csproj

-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
<Reference Include="Microsoft.AspNetCore.Server.IISIntegration" />
1414
<Reference Include="Microsoft.AspNetCore.Server.Kestrel" />
1515
<Reference Include="Microsoft.EntityFrameworkCore.Sqlite" />
16-
<!-- Avoid CS1705 errors due to mix of assemblies brought in transitively. -->
17-
<Reference Include="Microsoft.Extensions.DependencyInjection.Abstractions" />
1816
</ItemGroup>
1917

2018
</Project>

src/Middleware/HealthChecks.EntityFrameworkCore/test/Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore.Tests.csproj

-4
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@
99
<Reference Include="Microsoft.EntityFrameworkCore.InMemory" />
1010
<Reference Include="Microsoft.Extensions.DependencyInjection" />
1111
<Reference Include="Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore" />
12-
<!-- Avoid CS1705 errors due to mix of assemblies brought in transitively. -->
13-
<Reference Include="Microsoft.Extensions.DependencyInjection.Abstractions" />
14-
<Reference Include="Microsoft.Extensions.Diagnostics.HealthChecks" />
15-
<Reference Include="Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions" />
1612
</ItemGroup>
1713

1814
</Project>

src/Middleware/HealthChecks/test/testassets/HealthChecksSample/HealthChecksSample.csproj

-4
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@
1515
<Reference Include="Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore" />
1616
<Reference Include="Microsoft.Extensions.Logging.Console" />
1717
<Reference Include="Newtonsoft.Json" />
18-
<!-- Avoid CS1705 errors due to mix of assemblies brought in transitively. -->
19-
<Reference Include="Microsoft.Extensions.DependencyInjection.Abstractions" />
20-
<Reference Include="Microsoft.Extensions.Diagnostics.HealthChecks" />
21-
<Reference Include="Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions" />
2218
</ItemGroup>
2319

2420
</Project>

src/Security/samples/Identity.ExternalClaims/Identity.ExternalClaims.csproj

-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,5 @@
2626
<Reference Include="Microsoft.Extensions.Configuration.UserSecrets" />
2727
<Reference Include="Microsoft.Extensions.Logging.Console" />
2828
<Reference Include="Microsoft.Extensions.Logging.Debug" />
29-
<!-- Avoid CS1705 errors due to mix of assemblies brought in transitively. -->
30-
<Reference Include="Microsoft.Extensions.DependencyInjection.Abstractions" />
3129
</ItemGroup>
3230
</Project>

src/Servers/Connections.Abstractions/src/Microsoft.AspNetCore.Connections.Abstractions.csproj

+5-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,11 @@
2121
<Compile Include="$(SharedSourceRoot)CodeAnalysis\*.cs" />
2222
</ItemGroup>
2323

24-
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0' OR '$(TargetFramework)' == '$(DefaultNetFxTargetFramework)'">
24+
<!-- Special case building from source because Microsoft.Bcl.AsyncInterfaces isn't available for source builds. -->
25+
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0' OR
26+
'$(TargetFramework)' == '$(DefaultNetFxTargetFramework)' OR
27+
('$(MSBuildRestoreSessionId)' == '' AND '$(DotNetBuildFromSource)' != 'true') ">
2528
<Reference Include="Microsoft.Bcl.AsyncInterfaces" />
2629
</ItemGroup>
27-
30+
2831
</Project>

src/SignalR/clients/csharp/Http.Connections.Client/src/Microsoft.AspNetCore.Http.Connections.Client.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<Reference Include="Microsoft.Extensions.Options" />
2424
</ItemGroup>
2525

26-
<ItemGroup Condition="'$(TargetFramework)' == '$(DefaultNetFxTargetFramework)'">
26+
<ItemGroup Condition="'$(TargetFramework)' == '$(DefaultNetFxTargetFramework)' OR '$(MSBuildRestoreSessionId)' == ''">
2727
<Reference Include="System.Net.Http" />
2828
<Reference Include="System.Runtime.InteropServices.RuntimeInformation" />
2929
</ItemGroup>

src/SignalR/clients/ts/FunctionalTests/SignalR.Client.FunctionalTestApp.csproj

-2
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@
3636
<Reference Include="Microsoft.Extensions.Logging.Debug" />
3737
<Reference Include="Newtonsoft.Json" />
3838
<Reference Include="System.Reactive.Linq" />
39-
<!-- Avoid CS1705 errors due to mix of assemblies brought in transitively. -->
40-
<Reference Include="Microsoft.AspNetCore.SignalR.Common" />
4139
</ItemGroup>
4240

4341
<ItemGroup>

src/SignalR/common/Http.Connections.Common/src/Microsoft.AspNetCore.Http.Connections.Common.csproj

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
<Reference Include="Microsoft.AspNetCore.Connections.Abstractions" />
2121
</ItemGroup>
2222

23-
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0' OR '$(TargetFramework)' == '$(DefaultNetFxTargetFramework)'">
23+
<ItemGroup
24+
Condition="'$(TargetFramework)' == 'netstandard2.0' OR '$(TargetFramework)' == '$(DefaultNetFxTargetFramework)' OR '$(MSBuildRestoreSessionId)' == ''">
2425
<Reference Include="System.Text.Json" />
2526
</ItemGroup>
2627

src/SignalR/common/SignalR.Common/src/Microsoft.AspNetCore.SignalR.Common.csproj

+3-2
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,12 @@
2525
<Reference Include="Microsoft.Extensions.Options" />
2626
</ItemGroup>
2727

28-
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0' OR '$(TargetFramework)' == '$(DefaultNetFxTargetFramework)'">
28+
<ItemGroup
29+
Condition="'$(TargetFramework)' == 'netstandard2.0' OR '$(TargetFramework)' == '$(DefaultNetFxTargetFramework)' OR '$(MSBuildRestoreSessionId)' == ''">
2930
<Reference Include="System.Text.Json" />
3031
</ItemGroup>
3132

32-
<ItemGroup Condition="'$(TargetFramework)' == '$(DefaultNetFxTargetFramework)'">
33+
<ItemGroup Condition="'$(TargetFramework)' == '$(DefaultNetFxTargetFramework)' OR '$(MSBuildRestoreSessionId)' == ''">
3334
<Reference Include="System.Net.Sockets" />
3435
</ItemGroup>
3536

src/SignalR/common/testassets/Tests.Utils/Microsoft.AspNetCore.SignalR.Tests.Utils.csproj

-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
<Reference Include="Microsoft.AspNetCore.SignalR.Protocols.MessagePack" />
2020
<Reference Include="Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson" />
2121
<Reference Include="Microsoft.AspNetCore.Testing" />
22-
<!-- Avoid CS1705 errors due to mix of assemblies brought in transitively. -->
23-
<Reference Include="Microsoft.AspNetCore.SignalR.Common" />
2422

2523
<Compile Include="$(SharedSourceRoot)ValueStopwatch\*.cs" />
2624
<Compile Include="$(SharedSourceRoot)SignalR\*.cs" />

src/SignalR/samples/ClientSample/ClientSample.csproj

-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
<Reference Include="Microsoft.AspNetCore.SignalR.Client" />
1515
<Reference Include="Microsoft.Extensions.Logging.Console" />
1616
<Reference Include="Microsoft.Extensions.Logging" />
17-
<!-- Avoid CS1705 errors due to mix of assemblies brought in transitively. -->
18-
<Reference Include="Microsoft.AspNetCore.SignalR.Common" />
1917
</ItemGroup>
2018

2119
</Project>

src/SignalR/samples/JwtClientSample/JwtClientSample.csproj

-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77

88
<ItemGroup>
99
<Reference Include="Microsoft.AspNetCore.SignalR.Client" />
10-
<!-- Avoid CS1705 errors due to mix of assemblies brought in transitively. -->
11-
<Reference Include="Microsoft.AspNetCore.SignalR.Common" />
1210
</ItemGroup>
1311

1412
</Project>

src/SignalR/samples/SignalRSamples/SignalRSamples.csproj

-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
<Reference Include="Microsoft.Extensions.Configuration.CommandLine" />
2121
<Reference Include="Microsoft.Extensions.Logging.Console" />
2222
<Reference Include="System.Reactive.Linq" />
23-
<!-- Avoid CS1705 errors due to mix of assemblies brought in transitively. -->
24-
<Reference Include="Microsoft.AspNetCore.SignalR.Common" />
2523
</ItemGroup>
2624

2725
<Target Name="CopyTSClient" BeforeTargets="AfterBuild">

src/SignalR/server/Specification.Tests/src/Microsoft.AspNetCore.SignalR.Specification.Tests.csproj

-2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@
2424
<Reference Include="Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson" />
2525
<Reference Include="xunit.assert" />
2626
<Reference Include="xunit.extensibility.core" />
27-
<!-- Avoid CS1705 errors due to mix of assemblies brought in transitively. -->
28-
<Reference Include="Microsoft.AspNetCore.SignalR.Common" />
2927
</ItemGroup>
3028

3129
</Project>

src/Testing/src/Microsoft.AspNetCore.Testing.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
<Reference Include="xunit.extensibility.execution" />
4646
</ItemGroup>
4747

48-
<ItemGroup Condition="'$(TargetFramework)' == '$(DefaultNetFxTargetFramework)'">
48+
<ItemGroup Condition="'$(TargetFramework)' == '$(DefaultNetFxTargetFramework)' OR '$(MSBuildRestoreSessionId)' == ''">
4949
<Reference Include="System.Net.Http" />
5050
<Reference Include="System.Runtime.InteropServices.RuntimeInformation" />
5151
</ItemGroup>

src/Testing/test/Microsoft.AspNetCore.Testing.Tests.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<Reference Include="System.Runtime.InteropServices.RuntimeInformation" />
1818
</ItemGroup>
1919

20-
<ItemGroup Condition="'$(TargetFramework)' == 'net472'">
20+
<ItemGroup Condition="'$(TargetFramework)' == 'net472' OR '$(MSBuildRestoreSessionId)' == ''">
2121
<Reference Include="System.Net.Http" />
2222
</ItemGroup>
2323
</Project>

src/WebEncoders/src/Microsoft.Extensions.WebEncoders.csproj

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
<Reference Include="Microsoft.Extensions.Options" />
1616
</ItemGroup>
1717

18-
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0' OR '$(TargetFramework)' == '$(DefaultNetFxTargetFramework)'">
18+
<ItemGroup
19+
Condition="'$(TargetFramework)' == 'netstandard2.0' OR '$(TargetFramework)' == '$(DefaultNetFxTargetFramework)' OR '$(MSBuildRestoreSessionId)' == ''">
1920
<Reference Include="System.Text.Encodings.Web" />
2021
</ItemGroup>
2122

0 commit comments

Comments
 (0)